diff options
Diffstat (limited to 'js/util.ts')
-rw-r--r-- | js/util.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/js/util.ts b/js/util.ts index b81b96aca..348e36a1f 100644 --- a/js/util.ts +++ b/js/util.ts @@ -131,6 +131,21 @@ export function requiredArguments( } } +// @internal +export function immutableDefine( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + o: any, + p: string | number | symbol, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + value: any +): void { + Object.defineProperty(o, p, { + value, + configurable: false, + writable: false + }); +} + // Returns values from a WeakMap to emulate private properties in JavaScript export function getPrivateValue< K extends object, |