Skip to content

Commit a0f5ae5

Browse files
committed
fix a bug with setting properties of fields
1 parent ab27389 commit a0f5ae5

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/intercept.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ export default function intercept<V>(value: V, key: string, interceptCallback: (
2929
return value
3030
}
3131
},
32-
set(target, name: string, value: any): boolean {
33-
// @ts-ignore
34-
const result = (target[name] = value)
35-
if (!!result) {
36-
interceptCallback(key, '$$iposDefine', name, value)
37-
}
38-
return !!result
32+
set(target: V, name, value: any): boolean {
33+
if (!target || typeof target !== 'object') return false
34+
target[name as keyof typeof target] = value
35+
interceptCallback(key, '$$iposDefine', name, value)
36+
return true
3937
},
4038
})
4139
}

0 commit comments

Comments
 (0)