diff --git a/src/compiler/compile/utils/get_object.ts b/src/compiler/compile/utils/get_object.ts index 75b1964a13..10760740a0 100644 --- a/src/compiler/compile/utils/get_object.ts +++ b/src/compiler/compile/utils/get_object.ts @@ -1,28 +1,13 @@ import { Node, Identifier, - ArrayExpression, - ObjectExpression, - ThisExpression, - ObjectPattern, - ArrayPattern, - Literal, } from "estree"; -type ObjectType = - | Identifier - | ThisExpression - | ArrayExpression - | ObjectExpression - | ArrayPattern - | ObjectPattern - | Literal; - -export default function get_object(node: Node): ObjectType { +export default function get_object(node: Node): Identifier { while (true) { if (node.type === "MemberExpression") node = node.object; else if (node.type === "CallExpression") node = node.callee; else break; } - return node as ObjectType; + return node as Identifier; } diff --git a/test/runtime/samples/binding-input-text-map/_config.js b/test/runtime/samples/binding-input-text-map/_config.js index 8c58a84d5c..e0e25d419c 100644 --- a/test/runtime/samples/binding-input-text-map/_config.js +++ b/test/runtime/samples/binding-input-text-map/_config.js @@ -20,5 +20,9 @@ export default { assert.equal(input.value, '42'); assert.equal(component.map.get(component.id).x, '42') + + component.map.set(3, { x: 7, y: 8 }); + component.id = 3; + assert.equal(input.value, '7'); } };