mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 20:37:00 -05:00
Check this expressions in object literal methods
Add a test and baseline
This commit is contained in:
@@ -7494,6 +7494,14 @@ namespace ts {
|
||||
const symbol = getSymbolOfNode(container.parent);
|
||||
return container.flags & NodeFlags.Static ? getTypeOfSymbol(symbol) : (<InterfaceType>getDeclaredTypeOfSymbol(symbol)).thisType;
|
||||
}
|
||||
if (container.parent && container.parent.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
// Note: this works because object literal methods are deferred,
|
||||
// which means that the type of the containing object literal is already known.
|
||||
const type = checkExpressionCached(<ObjectLiteralExpression>container.parent);
|
||||
if (type) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
if (isInJavaScriptFile(node)) {
|
||||
const type = getTypeForThisExpressionFromJSDoc(container);
|
||||
|
||||
Reference in New Issue
Block a user