TypeScript/tests/cases/fourslash/codeFixClassImplementInterfaceComputedPropertyNameWellKnownSymbols.ts
Nathan Shively-Sanders 594430f113
Infer from arrows from usage. (#28832)
* Infer from arrows from usage.

Previously only function expressions were, and only those with an easily
accessible name. Now any arrow function or function expression will
infer from usage.

* remove isApplicableFunctionForInference

*all* functions are applicable for inference now.
2018-12-04 09:03:08 -08:00

72 lines
2.4 KiB
TypeScript

/// <reference path='fourslash.ts' />
// @lib: es2017
////interface I<Species> {
//// [Symbol.hasInstance](o: any): boolean;
//// [Symbol.isConcatSpreadable]: boolean;
//// [Symbol.iterator](): any;
//// [Symbol.match]: boolean;
//// [Symbol.replace](...args);
//// [Symbol.search](str: string): number;
//// [Symbol.species](): Species;
//// [Symbol.split](str: string, limit?: number): string[];
//// [Symbol.toPrimitive](hint: "number"): number;
//// [Symbol.toPrimitive](hint: "default"): number;
//// [Symbol.toPrimitive](hint: "string"): string;
//// [Symbol.toStringTag]: string;
//// [Symbol.unscopables]: any;
////}
////class C implements I<number> {}
verify.codeFix({
index: 0,
description: "Implement interface 'I<number>'",
newFileContent:
`interface I<Species> {
[Symbol.hasInstance](o: any): boolean;
[Symbol.isConcatSpreadable]: boolean;
[Symbol.iterator](): any;
[Symbol.match]: boolean;
[Symbol.replace](...args);
[Symbol.search](str: string): number;
[Symbol.species](): Species;
[Symbol.split](str: string, limit?: number): string[];
[Symbol.toPrimitive](hint: "number"): number;
[Symbol.toPrimitive](hint: "default"): number;
[Symbol.toPrimitive](hint: "string"): string;
[Symbol.toStringTag]: string;
[Symbol.unscopables]: any;
}
class C implements I<number> {
[Symbol.hasInstance](o: any): boolean {
throw new Error("Method not implemented.");
}
[Symbol.isConcatSpreadable]: boolean;
[Symbol.iterator]() {
throw new Error("Method not implemented.");
}
[Symbol.match]: boolean;
[Symbol.replace](...args: {}) {
throw new Error("Method not implemented.");
}
[Symbol.search](str: string): number {
throw new Error("Method not implemented.");
}
[Symbol.species](): number {
throw new Error("Method not implemented.");
}
[Symbol.split](str: string, limit?: number): {} {
throw new Error("Method not implemented.");
}
[Symbol.toPrimitive](hint: "number"): number;
[Symbol.toPrimitive](hint: "default"): number;
[Symbol.toPrimitive](hint: "string"): string;
[Symbol.toPrimitive](hint: any) {
throw new Error("Method not implemented.");
}
[Symbol.toStringTag]: string\;
[Symbol.unscopables]: any;
}`,
});