mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-30 15:15:38 -05:00
Fix #20523
This commit is contained in:
@@ -148,6 +148,11 @@ namespace ts.codefix {
|
||||
containingFunction.parameters.map(p => isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, sourceFile, program, cancellationToken) : undefined);
|
||||
if (!types) return undefined;
|
||||
|
||||
// We didn't actually find a set of type inference positions matching each parameter position
|
||||
if (containingFunction.parameters.length !== types.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const textChanges = arrayFrom(mapDefinedIterator(zipToIterator(containingFunction.parameters, types), ([parameter, type]) =>
|
||||
type && !parameter.type && !parameter.initializer ? makeChange(containingFunction, parameter.end, type, program) : undefined));
|
||||
return textChanges.length ? { declaration: parameterDeclaration, textChanges } : undefined;
|
||||
|
||||
9
tests/cases/fourslash/incompleteFunctionCallCodefix.ts
Normal file
9
tests/cases/fourslash/incompleteFunctionCallCodefix.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noImplicitAny: true
|
||||
//// function f(/*1*/x) {
|
||||
//// }
|
||||
//// f(
|
||||
|
||||
verify.not.codeFixAvailable([]);
|
||||
|
||||
Reference in New Issue
Block a user