File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ namespace ts {
42
42
let value : Expression ;
43
43
if ( isDestructuringAssignment ( node ) ) {
44
44
value = node . right ;
45
- while ( isEmptyObjectLiteralOrArrayLiteral ( node . left ) ) {
45
+ while ( isEmptyArrayLiteral ( node . left ) || isEmptyObjectLiteral ( node . left ) ) {
46
46
if ( isDestructuringAssignment ( value ) ) {
47
47
location = node = value ;
48
48
value = node . right ;
Original file line number Diff line number Diff line change @@ -3093,15 +3093,14 @@ namespace ts {
3093
3093
( node . parent . kind === SyntaxKind . PropertyAccessExpression && ( < PropertyAccessExpression > node . parent ) . name === node ) ;
3094
3094
}
3095
3095
3096
- export function isEmptyObjectLiteralOrArrayLiteral ( expression : Node ) : boolean {
3097
- const kind = expression . kind ;
3098
- if ( kind === SyntaxKind . ObjectLiteralExpression ) {
3099
- return ( < ObjectLiteralExpression > expression ) . properties . length === 0 ;
3100
- }
3101
- if ( kind === SyntaxKind . ArrayLiteralExpression ) {
3102
- return ( < ArrayLiteralExpression > expression ) . elements . length === 0 ;
3103
- }
3104
- return false ;
3096
+ export function isEmptyObjectLiteral ( expression : Node ) : boolean {
3097
+ return expression . kind === SyntaxKind . ObjectLiteralExpression &&
3098
+ ( < ObjectLiteralExpression > expression ) . properties . length === 0 ;
3099
+ }
3100
+
3101
+ export function isEmptyArrayLiteral ( expression : Node ) : boolean {
3102
+ return expression . kind === SyntaxKind . ArrayLiteralExpression &&
3103
+ ( < ArrayLiteralExpression > expression ) . elements . length === 0 ;
3105
3104
}
3106
3105
3107
3106
export function getLocalSymbolForExportDefault ( symbol : Symbol ) {
You can’t perform that action at this time.
0 commit comments