mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
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:
@@ -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([]);
|
||||
|
||||
Reference in New Issue
Block a user