fix: internal createSignature support undefined declaration (#44109)

This commit is contained in:
ZYSzys
2021-05-24 21:50:20 +08:00
committed by GitHub
parent 6df16b35f2
commit eb7c1ada6f
2 changed files with 2 additions and 3 deletions

View File

@@ -4226,7 +4226,7 @@ namespace ts {
/* @internal */ isTypeAssignableTo(source: Type, target: Type): boolean;
/* @internal */ createAnonymousType(symbol: Symbol | undefined, members: SymbolTable, callSignatures: Signature[], constructSignatures: Signature[], stringIndexInfo: IndexInfo | undefined, numberIndexInfo: IndexInfo | undefined): Type;
/* @internal */ createSignature(
declaration: SignatureDeclaration,
declaration: SignatureDeclaration | undefined,
typeParameters: readonly TypeParameter[] | undefined,
thisParameter: Symbol | undefined,
parameters: readonly Symbol[],

View File

@@ -1135,8 +1135,7 @@ namespace ts.codefix {
parameters.push(symbol);
}
const returnType = combineFromUsage(combineUsages(calls.map(call => call.return_)));
// TODO: GH#18217
return checker.createSignature(/*declaration*/ undefined!, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, SignatureFlags.None);
return checker.createSignature(/*declaration*/ undefined, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, SignatureFlags.None);
}
function addCandidateType(usage: Usage, type: Type | undefined) {