mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Contextual signatures without thisType return anyType
If a contextual signature is found, if its thisType is undefined, then the contextual type of `this` is now `any`. Previously `checkThisExpression` would keep looking for a different type for `this`. Also update tests to show this new behaviour.
This commit is contained in:
@@ -8453,7 +8453,7 @@ namespace ts {
|
||||
if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== SyntaxKind.ArrowFunction) {
|
||||
const contextualSignature = getContextualSignature(func);
|
||||
if (contextualSignature) {
|
||||
return contextualSignature.thisType;
|
||||
return contextualSignature.thisType || anyType;
|
||||
}
|
||||
else if (getContextualTypeForFunctionLikeDeclaration(func) === anyType) {
|
||||
return anyType;
|
||||
|
||||
Reference in New Issue
Block a user