Skip to content

Commit 24b39f9

Browse files
authored
Skip implicit any suggestions with no codefix (#28822)
The only unsupported one is binding patterns, which aren't supported by the codefix. The code was a lot faster to write without supporting them, but there's no real barrier besides that.
1 parent 594430f commit 24b39f9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13684,6 +13684,10 @@ namespace ts {
1368413684
break;
1368513685
case SyntaxKind.BindingElement:
1368613686
diagnostic = Diagnostics.Binding_element_0_implicitly_has_an_1_type;
13687+
if (!noImplicitAny) {
13688+
// Don't issue a suggestion for binding elements since the codefix doesn't yet support them.
13689+
return;
13690+
}
1368713691
break;
1368813692
case SyntaxKind.JSDocFunctionType:
1368913693
error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference path='fourslash.ts' />
2+
////function f([car, cdr]) {
3+
//// return car + cdr + 1
4+
////}
5+
6+
// When inferFromUsage supports it, it should infer number for both variables
7+
verify.getSuggestionDiagnostics([]);
8+

0 commit comments

Comments
 (0)