-
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
- Loading branch information
1 parent
69cc9ba
commit 5af5076
Showing
14 changed files
with
413 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,37 @@ | ||
/// <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"; | ||
////} | ||
////[|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" | ||
}` | ||
}); |
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 | ||
}; | ||
}` | ||
}); |
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,19 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////interface Foo { | ||
//// a: number; | ||
//// b: string; | ||
////} | ||
////[|function fn(foo: Foo = {}) { | ||
////}|] | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: ts.Diagnostics.Add_missing_properties.message, | ||
newRangeContent: | ||
`function fn(foo: Foo = { | ||
a: 0, | ||
b: "" | ||
}) { | ||
}` | ||
}); |
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,17 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////interface Foo { | ||
//// a: number; | ||
//// b: string; | ||
////} | ||
////[|const foo: Foo = { a: 10 }|]; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: ts.Diagnostics.Add_missing_properties.message, | ||
newRangeContent: | ||
`const foo: Foo = { | ||
a: 10, | ||
b: "" | ||
}` | ||
}); |
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,16 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////type T = { | ||
//// a: null; | ||
////} | ||
//// | ||
////[|const foo: T = {}|]; | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: ts.Diagnostics.Add_missing_properties.message, | ||
newRangeContent: | ||
`const foo: T = { | ||
a: null | ||
}` | ||
}); |
Oops, something went wrong.