feat(47281): use unknown type instead of any (#47308)

This commit is contained in:
Oleksandr T
2022-02-17 23:54:02 +02:00
committed by GitHub
parent 55e2e15aa3
commit 51d34466e7
11 changed files with 12 additions and 13 deletions

View File

@@ -359,7 +359,7 @@ namespace ts.codefix {
/*dotDotDotToken*/ undefined,
/*name*/ names && names[i] || `arg${i}`,
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? factory.createToken(SyntaxKind.QuestionToken) : undefined,
/*type*/ inJs ? undefined : types && types[i] || factory.createKeywordTypeNode(SyntaxKind.AnyKeyword),
/*type*/ inJs ? undefined : types && types[i] || factory.createKeywordTypeNode(SyntaxKind.UnknownKeyword),
/*initializer*/ undefined);
parameters.push(newParameter);
}
@@ -398,14 +398,13 @@ namespace ts.codefix {
const parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false);
if (someSigHasRestParameter) {
const anyArrayType = factory.createArrayTypeNode(factory.createKeywordTypeNode(SyntaxKind.AnyKeyword));
const restParameter = factory.createParameterDeclaration(
/*decorators*/ undefined,
/*modifiers*/ undefined,
factory.createToken(SyntaxKind.DotDotDotToken),
maxArgsParameterSymbolNames[maxNonRestArgs] || "rest",
/*questionToken*/ maxNonRestArgs >= minArgumentCount ? factory.createToken(SyntaxKind.QuestionToken) : undefined,
anyArrayType,
factory.createArrayTypeNode(factory.createKeywordTypeNode(SyntaxKind.UnknownKeyword)),
/*initializer*/ undefined);
parameters.push(restParameter);
}