vacuumlabs / babel-plugin-extensible-destructuring

Plugin for extensible destructuring in Babel
BSD 2-Clause "Simplified" License
116 stars 11 forks source link

Default array value causes a compile error #17

Open tgecho opened 7 years ago

tgecho commented 7 years ago
const [a, b, c = DEFAULT_C] = myArray;

Setting a default value when destructuring an array triggers the following compile error:

ERROR in ./my/source.js
Module build failed: Error: /my/project/my/source.js: shouldnt get here, handling of AssignmentPattert is inlined into ObjectPattern
    at DestructuringTransformer.push (/my/project/node_modules/babel-plugin-extensible-destructuring/lib/index.js:148:17)
    at DestructuringTransformer.pushArrayPattern (/my/project/node_modules/babel-plugin-extensible-destructuring/lib/index.js:388:16)
    at DestructuringTransformer.push (/my/project/node_modules/babel-plugin-extensible-destructuring/lib/index.js:146:16)
    at DestructuringTransformer.init (/my/project/node_modules/babel-plugin-extensible-destructuring/lib/index.js:405:14)
    at PluginPass.VariableDeclaration (/my/project/node_modules/babel-plugin-extensible-destructuring/lib/index.js:627:27)
    at newFn (/my/project/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (/my/project/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/my/project/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/my/project/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/my/project/node_modules/babel-traverse/lib/context.js:150:16)
 @ ./my/other.js 41:19-43