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.
This commit is contained in:
Nathan Shively-Sanders
2018-12-04 09:17:37 -08:00
committed by GitHub
parent 594430f113
commit 24b39f90c9
2 changed files with 12 additions and 0 deletions
+4
View File
@@ -13684,6 +13684,10 @@ namespace ts {
break;
case SyntaxKind.BindingElement:
diagnostic = Diagnostics.Binding_element_0_implicitly_has_an_1_type;
if (!noImplicitAny) {
// Don't issue a suggestion for binding elements since the codefix doesn't yet support them.
return;
}
break;
case SyntaxKind.JSDocFunctionType:
error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
@@ -0,0 +1,8 @@
/// <reference path='fourslash.ts' />
////function f([car, cdr]) {
//// return car + cdr + 1
////}
// When inferFromUsage supports it, it should infer number for both variables
verify.getSuggestionDiagnostics([]);