fix(48520): fix getting parameter type by index (#48521)

This commit is contained in:
Oleksandr T
2022-04-04 07:42:37 +03:00
committed by GitHub
parent b1a25fd8b1
commit 2db17fdda2
2 changed files with 15 additions and 1 deletions

View File

@@ -169,7 +169,7 @@ namespace ts.codefix {
const param = signature.parameters[argIndex].valueDeclaration;
if (!(param && isParameter(param) && isIdentifier(param.name))) return undefined;
const properties = arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getTypeAtLocation(param), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
const properties = arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
if (!length(properties)) return undefined;
return { kind: InfoKind.ObjectLiteral, token: param.name, properties, parentDeclaration: parent };
}