mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 20:33:45 -05:00
Generalise empty object literal property access fix to all object literals
This commit is contained in:
@@ -3816,13 +3816,13 @@ namespace ts {
|
||||
// NewExpression:
|
||||
// new C.x -> not the same as (new C).x
|
||||
//
|
||||
// EmptyObjectLiteral:
|
||||
// {}.toString() -> is incorrect syntax, should be ({}).x
|
||||
// ObjectLiteral:
|
||||
// {a:1}.toString() -> is incorrect syntax, should be ({a:3}).toString()
|
||||
//
|
||||
const emittedExpression = skipPartiallyEmittedExpressions(expression);
|
||||
if (isLeftHandSideExpression(emittedExpression)
|
||||
&& (!isNewExpression(emittedExpression) || (<NewExpression>emittedExpression).arguments)
|
||||
&& !isEmptyObjectLiteral(emittedExpression)) {
|
||||
&& !isObjectLiteralExpression(emittedExpression)) {
|
||||
return <LeftHandSideExpression>expression;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user