fix(lib/utils/objects): use Object.defineProperty instead of delete
This commit is contained in:
parent
796f1cf392
commit
aacb038d09
1 changed files with 8 additions and 2 deletions
|
|
@ -139,8 +139,14 @@ function lazyPropDesc<T extends object, K extends keyof T>(
|
|||
return {
|
||||
configurable: true,
|
||||
get(this: T) {
|
||||
delete this[key]
|
||||
return (this[key] = loader())
|
||||
const value = loader()
|
||||
|
||||
Object.defineProperty(this, key, {
|
||||
configurable: true,
|
||||
value,
|
||||
})
|
||||
|
||||
return value
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue