@@ -3549,7 +3549,7 @@ namespace ts {
3549
3549
return;
3550
3550
}
3551
3551
3552
- if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length && isStrictSignature(resolved.callSignatures[0]) ) {
3552
+ if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
3553
3553
const parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags);
3554
3554
if (parenthesizeSignature) {
3555
3555
writePunctuation(writer, SyntaxKind.OpenParenToken);
@@ -3560,7 +3560,7 @@ namespace ts {
3560
3560
}
3561
3561
return;
3562
3562
}
3563
- if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length && isStrictSignature(resolved.constructSignatures[0]) ) {
3563
+ if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
3564
3564
if (flags & TypeFormatFlags.InElementType) {
3565
3565
writePunctuation(writer, SyntaxKind.OpenParenToken);
3566
3566
}
@@ -8522,17 +8522,6 @@ namespace ts {
8522
8522
/*errorReporter*/ undefined, compareTypesAssignable) !== Ternary.False;
8523
8523
}
8524
8524
8525
- // A signature is considered strict if it is declared in a function type literal, a constructor type
8526
- // literal, a function expression, an arrow function, or a function declaration with no overloads. A
8527
- // strict signature is subject to strict checking in strictFunctionTypes mode.
8528
- function isStrictSignature(signature: Signature) {
8529
- const declaration = signature.declaration;
8530
- const kind = declaration ? declaration.kind : SyntaxKind.Unknown;
8531
- return kind === SyntaxKind.FunctionType || kind === SyntaxKind.ConstructorType ||
8532
- kind === SyntaxKind.FunctionExpression || kind === SyntaxKind.ArrowFunction ||
8533
- (kind === SyntaxKind.FunctionDeclaration && getSingleCallSignature(getTypeOfSymbol(getSymbolOfNode(declaration))));
8534
- }
8535
-
8536
8525
type ErrorReporter = (message: DiagnosticMessage, arg0?: string, arg1?: string) => void;
8537
8526
8538
8527
/**
@@ -8558,7 +8547,9 @@ namespace ts {
8558
8547
source = instantiateSignatureInContextOf(source, target, /*contextualMapper*/ undefined, compareTypes);
8559
8548
}
8560
8549
8561
- const strictVariance = strictFunctionTypes && isStrictSignature(target);
8550
+ const kind = target.declaration ? target.declaration.kind : SyntaxKind.Unknown;
8551
+ const strictVariance = strictFunctionTypes && kind !== SyntaxKind.MethodDeclaration &&
8552
+ kind !== SyntaxKind.MethodSignature && kind !== SyntaxKind.Constructor;
8562
8553
let result = Ternary.True;
8563
8554
8564
8555
const sourceThisType = getThisTypeOfSignature(source);
0 commit comments