Skip to content

Commit 9974a27

Browse files
committed
Add error code
1 parent 72034e5 commit 9974a27

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/services/codefixes/fixAddMissingConstraint.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace ts.codefix {
1111
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
1212
Diagnostics.Property_0_is_incompatible_with_index_signature.code,
1313
Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
14+
Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
1415
];
1516
registerCodeFix({
1617
errorCodes,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @Filename: file.ts
4+
////interface Fn<T extends string> {
5+
////}
6+
////
7+
////function m<T>(x: Fn<T/**/>) {
8+
////}
9+
goTo.marker("");
10+
verify.codeFix({
11+
index: 0,
12+
description: "Add `extends` constraint.",
13+
newFileContent: {
14+
"/tests/cases/fourslash/file.ts":
15+
`interface Fn<T extends string> {
16+
}
17+
18+
function m<T extends string>(x: Fn<T>) {
19+
}`
20+
}
21+
});

0 commit comments

Comments
 (0)