mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 20:25:23 -06:00
Fix contextual typing of object literal methods
This commit is contained in:
parent
d163f8326d
commit
a9055b8729
@ -5952,8 +5952,10 @@ module ts {
|
||||
}
|
||||
|
||||
function getContextualSignatureForFunctionLikeDeclaration(node: FunctionLikeDeclaration): Signature {
|
||||
// Only function expressions and arrow functions are contextually typed.
|
||||
return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(<FunctionExpression>node) : undefined;
|
||||
// Only function expressions, arrow functions, and object literal methods are contextually typed.
|
||||
return isFunctionExpressionOrArrowFunction(node) || isObjectLiteralMethod(node)
|
||||
? getContextualSignature(<FunctionExpression>node)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
// Return the contextual signature for a given expression node. A contextual type provides a
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user