mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Generalise empty object literal property access fix to all object literals
This commit is contained in:
1 parent
c79000801f
commit
2c028ae3e5
54 files changed
+391
-391
No files matched your search
@@ -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