mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Check strictly when either source or target is a strict signature
This commit is contained in:
@@ -16183,6 +16183,11 @@ namespace ts {
|
||||
isTypeAny(getReturnTypeOfSignature(s));
|
||||
}
|
||||
|
||||
function isStrictSignature(sig: Signature) {
|
||||
const kind = sig.declaration ? sig.declaration.kind : SyntaxKind.Unknown;
|
||||
return kind !== SyntaxKind.MethodDeclaration && kind !== SyntaxKind.MethodSignature && kind !== SyntaxKind.Constructor;
|
||||
}
|
||||
|
||||
/**
|
||||
* See signatureRelatedTo, compareSignaturesIdentical
|
||||
*/
|
||||
@@ -16226,9 +16231,7 @@ namespace ts {
|
||||
return Ternary.False;
|
||||
}
|
||||
|
||||
const kind = target.declaration ? target.declaration.kind : SyntaxKind.Unknown;
|
||||
const strictVariance = !(checkMode & SignatureCheckMode.Callback) && strictFunctionTypes && kind !== SyntaxKind.MethodDeclaration &&
|
||||
kind !== SyntaxKind.MethodSignature && kind !== SyntaxKind.Constructor;
|
||||
const strictVariance = !(checkMode & SignatureCheckMode.Callback) && strictFunctionTypes && (isStrictSignature(target) || isStrictSignature(source));
|
||||
let result = Ternary.True;
|
||||
|
||||
const sourceThisType = getThisTypeOfSignature(source);
|
||||
|
||||
Reference in New Issue
Block a user