mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 19:59:23 -05:00
Prefer non-partial signature match in non-generic case (#55447)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7216ee0bb8
commit
0a87761521
@@ -13242,9 +13242,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
let result: Signature[] | undefined;
|
||||
for (let i = 0; i < signatureLists.length; i++) {
|
||||
// Allow matching non-generic signatures to have excess parameters and different return types.
|
||||
// Allow matching non-generic signatures to have excess parameters (as a fallback if exact parameter match is not found) and different return types.
|
||||
// Prefer matching this types if possible.
|
||||
const match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true);
|
||||
const match = i === listIndex
|
||||
? signature
|
||||
: findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true)
|
||||
|| findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true);
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user