-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(28491): add QF to declare missing properties (#44576)
- Loading branch information
1 parent
9549928
commit eee34d5
Showing
17 changed files
with
488 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////interface Foo { | ||
//// a: number; | ||
//// b: string; | ||
//// c: 1; | ||
//// d: "d"; | ||
//// e: "e1" | "e2"; | ||
//// f(x: number, y: number): void; | ||
//// g: (x: number, y: number) => void; | ||
//// h: number[]; | ||
//// i: bigint; | ||
//// j: undefined | "special-string"; | ||
//// k: `--${string}`; | ||
////} | ||
////[|const foo: Foo = {}|]; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: ts.Diagnostics.Add_missing_properties.message, | ||
newRangeContent: | ||
`const foo: Foo = { | ||
a: 0, | ||
b: "", | ||
c: 1, | ||
d: "d", | ||
e: "e1", | ||
f: function(x: number, y: number): void { | ||
throw new Error("Function not implemented."); | ||
}, | ||
g: function(x: number, y: number): void { | ||
throw new Error("Function not implemented."); | ||
}, | ||
h: [], | ||
i: 0n, | ||
j: "special-string", | ||
k: "" | ||
}` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////type T = { x: number; }; | ||
////interface I { | ||
//// a: T | ||
////} | ||
////[|const foo: I = {};|] | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: ts.Diagnostics.Add_missing_properties.message, | ||
newRangeContent: | ||
`const foo: I = { | ||
a: { | ||
x: 0 | ||
} | ||
};` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////interface Foo { | ||
//// a: `--${string}`; | ||
//// b: string; | ||
//// c: "a" | "b" | ||
////} | ||
////[|const foo: Foo = {}|]; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: ts.Diagnostics.Add_missing_properties.message, | ||
preferences: { | ||
quotePreference: "single" | ||
}, | ||
newRangeContent: | ||
`const foo: Foo = { | ||
a: '', | ||
b: '', | ||
c: 'a' | ||
}` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////interface Foo { | ||
//// a: number; | ||
//// b: string; | ||
//// c: any; | ||
////} | ||
////[|class C { | ||
//// public c: Foo = {}; | ||
////}|] | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: ts.Diagnostics.Add_missing_properties.message, | ||
newRangeContent: | ||
`class C { | ||
public c: Foo = { | ||
a: 0, | ||
b: "", | ||
c: undefined | ||
}; | ||
}` | ||
}); |
Oops, something went wrong.