Skip to content

Commit c1911ae

Browse files
authored
fix(compiler-sfc): destructure StringLiteral key not register bindings (fix vuejs#4540)
1 parent 781d2d4 commit c1911ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/compiler-sfc/src/compileScript.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1347,8 +1347,8 @@ function walkObjectPattern(
13471347
) {
13481348
for (const p of node.properties) {
13491349
if (p.type === 'ObjectProperty') {
1350-
// key can only be Identifier in ObjectPattern
1351-
if (p.key.type === 'Identifier') {
1350+
// key can be Identifier in ObjectPattern or StringLiteral
1351+
if (p.key.type === 'Identifier' || p.key.type === 'StringLiteral') {
13521352
if (p.key === p.value) {
13531353
// const { x } = ...
13541354
const type = isDefineCall

0 commit comments

Comments
 (0)