File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 4444 },
4545 "devDependencies" : {
4646 "@types/acorn" : " 4.0.5" ,
47- "@types/estree" : " 0.0.42 " ,
47+ "@types/estree" : " 0.0.44 " ,
4848 "@types/node" : " 12.12.35" ,
4949 "@types/uuid" : " 7.0.2" ,
5050 "ava" : " 2.4.0" ,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828 VariableDeclaration ,
2929 ClassDeclaration ,
3030 ExportSpecifier ,
31+ Property ,
3132} from 'estree' ;
3233import * as acorn from 'acorn' ;
3334import { log } from './debug' ;
@@ -96,3 +97,6 @@ export function isClassDeclaration(node: BaseNode): node is ClassDeclaration {
9697export function isExportSpecifier ( node : BaseNode ) : node is ExportSpecifier {
9798 return node . type === 'ExportSpecifier' ;
9899}
100+ export function isProperty ( node : BaseNode ) : node is Property {
101+ return node . type === 'Property' ;
102+ }
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import { ChunkTransform } from '../../transform';
1818import { Range , TransformInterface } from '../../types' ;
1919import MagicString from 'magic-string' ;
2020import { ObjectExpression } from 'estree' ;
21- import { parse , walk } from '../../acorn' ;
21+ import { parse , walk , isProperty } from '../../acorn' ;
2222
2323/**
2424 * Closure Compiler will not transform computed keys with literal values back to the literal value.
@@ -40,7 +40,7 @@ export default class LiteralComputedKeys extends ChunkTransform implements Trans
4040 walk . simple ( program , {
4141 ObjectExpression ( node : ObjectExpression ) {
4242 for ( const property of node . properties ) {
43- if ( property . computed && property . key . type === 'Literal' ) {
43+ if ( isProperty ( property ) && property . computed && property . key . type === 'Literal' ) {
4444 const [ propertyStart ] : Range = property . range as Range ;
4545 const [ valueStart ] : Range = property . value . range as Range ;
4646
Original file line number Diff line number Diff line change 380380 resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.40.tgz#0e6cb9b9bbd098031fa19e4b4e8131bc70e5de13"
381381 integrity sha512-p3KZgMto/JyxosKGmnLDJ/dG5wf+qTRMUjHJcspC2oQKa4jP7mz+tv0ND56lLBu3ojHlhzY33Ol+khLyNmilkA==
382382
383- 384- version "0.0.42 "
385- resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.42 .tgz#8d0c1f480339efedb3e46070e22dd63e0430dd11 "
386- integrity sha512-K1DPVvnBCPxzD+G51/cxVIoc2X8uUVl1zpJeE6iKcgHMj4+tbat5Xu4TjV7v2QSDbIeAfLi2hIk+u2+s0MlpUQ ==
383+ 384+ version "0.0.44 "
385+ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.44 .tgz#980cc5a29a3ef3bea6ff1f7d021047d7ea575e21 "
386+ integrity sha512-iaIVzr+w2ZJ5HkidlZ3EJM8VTZb2MJLCjw3V+505yVts0gRC4UMvjw0d1HPtGqI/HQC/KdsYtayfzl+AXY2R8g ==
387387
388388" @types/events@* " :
389389 version "3.0.0"
You can’t perform that action at this time.
0 commit comments