From 1431a7016eff1b0bf08d9917e7815081827bf3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Berthommier?= Date: Thu, 22 Aug 2019 10:02:40 +0200 Subject: [PATCH] __hooks become writable and configurable We should be able to modify or delete this value. In a particular case it will avoid me this kind of error: ``` Uncaught TypeError: Cannot redefine property: __hooks ``` ``` Uncaught TypeError: Cannot delete property '__hooks' of # ``` --- packages/commons/src/hooks.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/commons/src/hooks.ts b/packages/commons/src/hooks.ts index f8d3882db2..9852c01422 100644 --- a/packages/commons/src/hooks.ts +++ b/packages/commons/src/hooks.ts @@ -154,7 +154,9 @@ export function enableHooks (obj: any, methods: string[], types: string[]) { // Add non-enumerable `__hooks` property to the object Object.defineProperty(obj, '__hooks', { - value: hookData + configurable: true, + value: hookData, + writable: true }); return Object.assign(obj, {