mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
remove any annotation from declare method quickfix
This commit is contained in:
parent
999eb0b9ed
commit
21ab39649c
@ -156,7 +156,7 @@ namespace ts.codefix {
|
||||
isIdentifier(arg) ? arg.text :
|
||||
isPropertyAccessExpression(arg) ? arg.name.text : undefined);
|
||||
const contextualType = checker.getContextualType(call);
|
||||
const returnType = inJs ? undefined : contextualType && checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker) || createKeywordTypeNode(SyntaxKind.AnyKeyword);
|
||||
const returnType = inJs ? undefined : contextualType && checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker);
|
||||
return createMethod(
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ makeStatic ? [createToken(SyntaxKind.StaticKeyword)] : undefined,
|
||||
|
||||
@ -18,7 +18,7 @@ verify.codeFixAll({
|
||||
const x = 0;
|
||||
this.y(x, "a", this.z);
|
||||
}
|
||||
y(x: number, arg1: string, z: boolean): any {
|
||||
y(x: number, arg1: string, z: boolean) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}`,
|
||||
|
||||
@ -36,7 +36,7 @@ verify.codeFixAll({
|
||||
this.y();
|
||||
this.x = "";
|
||||
}
|
||||
y(): any {
|
||||
y() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ verify.codeFixAll({
|
||||
*method() {
|
||||
yield* this.y();
|
||||
}
|
||||
*y(): any {
|
||||
*y() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}`,
|
||||
|
||||
@ -14,7 +14,7 @@ verify.codeFixAll({
|
||||
method() {
|
||||
yield* this.y();
|
||||
}
|
||||
y(): any {
|
||||
y() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}`,
|
||||
|
||||
@ -23,15 +23,15 @@ verify.getAndApplyCodeFix(/*errorCode*/undefined, 0);
|
||||
verify.getAndApplyCodeFix(/*errorCode*/undefined, 0);
|
||||
|
||||
verify.rangeIs(`
|
||||
m2(c: C): any {
|
||||
m2(c: C) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
y: {};
|
||||
m1(): any {
|
||||
m1() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
static x: any;
|
||||
static m0(arg0: number, arg1: string, arg2: undefined[]): any {
|
||||
static m0(arg0: number, arg1: string, arg2: undefined[]) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`);
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
verify.getAndApplyCodeFix(/*errorCode*/ undefined, 0);
|
||||
|
||||
verify.rangeIs(`
|
||||
m0(arg0: import("./f2").D): any {
|
||||
m0(arg0: import("./f2").D) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`);
|
||||
@ -20,7 +20,7 @@ verify.codeFix({
|
||||
this.prop1 = 10;
|
||||
A.prop2 = "asdf";
|
||||
}
|
||||
static m1(arg0: number, arg1: number, arg2: number): any {
|
||||
static m1(arg0: number, arg1: number, arg2: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}`,
|
||||
@ -38,10 +38,10 @@ verify.codeFix({
|
||||
this.prop1 = 10;
|
||||
A.prop2 = "asdf";
|
||||
}
|
||||
static m2(arg0: number, arg1: number): any {
|
||||
static m2(arg0: number, arg1: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
static m1(arg0: number, arg1: number, arg2: number): any {
|
||||
static m1(arg0: number, arg1: number, arg2: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}`,
|
||||
@ -60,10 +60,10 @@ verify.codeFix({
|
||||
this.prop1 = 10;
|
||||
A.prop2 = "asdf";
|
||||
}
|
||||
static m2(arg0: number, arg1: number): any {
|
||||
static m2(arg0: number, arg1: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
static m1(arg0: number, arg1: number, arg2: number): any {
|
||||
static m1(arg0: number, arg1: number, arg2: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}`,
|
||||
@ -83,10 +83,10 @@ verify.codeFix({
|
||||
this.prop1 = 10;
|
||||
A.prop2 = "asdf";
|
||||
}
|
||||
static m2(arg0: number, arg1: number): any {
|
||||
static m2(arg0: number, arg1: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
static m1(arg0: number, arg1: number, arg2: number): any {
|
||||
static m1(arg0: number, arg1: number, arg2: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}`,
|
||||
|
||||
@ -15,7 +15,7 @@ verify.codeFix({
|
||||
index: 0,
|
||||
newFileContent:
|
||||
`class A {
|
||||
foo1(arg0: number, arg1: number, arg2: number): any {
|
||||
foo1(arg0: number, arg1: number, arg2: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
constructor() {
|
||||
@ -34,10 +34,10 @@ verify.codeFix({
|
||||
index: 0,
|
||||
newFileContent:
|
||||
`class A {
|
||||
foo2<T, U, V, W, X, Y, Z>(): any {
|
||||
foo2<T, U, V, W, X, Y, Z>() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
foo1(arg0: number, arg1: number, arg2: number): any {
|
||||
foo1(arg0: number, arg1: number, arg2: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
constructor() {
|
||||
@ -56,13 +56,13 @@ verify.codeFix({
|
||||
index: 0,
|
||||
newFileContent:
|
||||
`class A {
|
||||
foo3<T0, T1, T2, T3, T4, T5, T6, T7>(): any {
|
||||
foo3<T0, T1, T2, T3, T4, T5, T6, T7>() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
foo2<T, U, V, W, X, Y, Z>(): any {
|
||||
foo2<T, U, V, W, X, Y, Z>() {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
foo1(arg0: number, arg1: number, arg2: number): any {
|
||||
foo1(arg0: number, arg1: number, arg2: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
constructor() {
|
||||
|
||||
@ -11,7 +11,7 @@ verify.codeFix({
|
||||
description: "Declare method 'foo1'",
|
||||
index: 0,
|
||||
newRangeContent: `
|
||||
foo1(arg0: () => number, arg1: () => string, arg2: () => boolean): any {
|
||||
foo1(arg0: () => number, arg1: () => string, arg2: () => boolean) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`,
|
||||
@ -22,10 +22,10 @@ verify.codeFix({
|
||||
description: "Declare method 'foo2'",
|
||||
index: 0,
|
||||
newRangeContent: `
|
||||
foo2(arg0: (a: number) => number, arg1: (b: string) => string, arg2: (c: boolean) => boolean): any {
|
||||
foo2(arg0: (a: number) => number, arg1: (b: string) => string, arg2: (c: boolean) => boolean) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
foo1(arg0: () => number, arg1: () => string, arg2: () => boolean): any {
|
||||
foo1(arg0: () => number, arg1: () => string, arg2: () => boolean) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`,
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
//// class A {[|
|
||||
//// |]constructor() {
|
||||
//// this.foo1(null, {}, { a: 1, b: "2"});
|
||||
//// const bar = this.foo2(null, {}, { a: 1, b: "2"});
|
||||
//// const baz: number = this.foo3(null, {}, { a: 1, b: "2"});
|
||||
//// }
|
||||
//// }
|
||||
|
||||
@ -10,7 +12,38 @@ verify.codeFix({
|
||||
description: "Declare method 'foo1'",
|
||||
index: 0,
|
||||
newRangeContent: `
|
||||
foo1(arg0: null, arg1: {}, arg2: { a: number; b: string; }): any {
|
||||
foo1(arg0: null, arg1: {}, arg2: { a: number; b: string; }) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`,
|
||||
applyChanges: true
|
||||
});
|
||||
|
||||
verify.codeFix({
|
||||
description: "Declare method 'foo2'",
|
||||
index: 0,
|
||||
newRangeContent: `
|
||||
foo2(arg0: null, arg1: {}, arg2: { a: number; b: string; }) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
foo1(arg0: null, arg1: {}, arg2: { a: number; b: string; }) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`,
|
||||
applyChanges: true
|
||||
});
|
||||
|
||||
verify.codeFix({
|
||||
description: "Declare method 'foo3'",
|
||||
index: 0,
|
||||
newRangeContent: `
|
||||
foo3(arg0: null, arg1: {}, arg2: { a: number; b: string; }): number {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
foo2(arg0: null, arg1: {}, arg2: { a: number; b: string; }) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
foo1(arg0: null, arg1: {}, arg2: { a: number; b: string; }) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user