JSON.stringify(attrs) + Object.keys(attrs)
)
})
+
+ // #691ef
+ test('should not mutate original props long-form definition object', () => {
+ const props = {
+ msg: {
+ type: String
+ }
+ }
+ const Comp = defineComponent({
+ props,
+ render() {}
+ })
+
+ const root = nodeOps.createElement('div')
+
+ render(h(Comp, { msg: 'test' }), root)
+
+ expect(Object.keys(props.msg).length).toBe(1)
+ })
})
if (validatePropName(normalizedKey)) {
const opt = raw[key]
const prop: NormalizedProp = (normalized[normalizedKey] =
- isArray(opt) || isFunction(opt) ? { type: opt } : opt)
+ isArray(opt) || isFunction(opt) ? { type: opt } : { ...opt })
if (prop) {
const booleanIndex = getTypeIndex(Boolean, prop.type)
const stringIndex = getTypeIndex(String, prop.type)