vacuumlabs/babel-plugin-extensible-destructuring

Default array value causes a compile error

tgecho opened this issue · 0 comments

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