Skip to main content
Module

x/tsafe/lab/index.ts>overwriteReadonlyProp

🔩 The missing TypeScript utils
Go to Latest
variable overwriteReadonlyProp
import { overwriteReadonlyProp } from "https://deno.land/x/tsafe@v1.6.4/lab/index.ts";

Assign a value to a property even if the object is freezed or if the property is not writable Throw if the assignation fail ( for example if the property is non configurable write: false )

type

<T extends { [key: string]: any; }, K extends keyof T>(
obj: T,
propertyName: K,
value: T[K],
) => T[K]