ethers.js/packages/properties/src.ts/freezable.ts
2022-04-11 17:09:17 -04:00

13 lines
317 B
TypeScript

export interface Freezable<T> {
clone(): T;
freeze(): Frozen<T>;
isFrozen(): boolean;
}
export type Frozen<T> = Readonly<{
[ P in keyof T ]: T[P] extends (...args: Array<any>) => any ? T[P]:
T[P] extends Freezable<any> ? Frozen<T[P]>:
Readonly<T[P]>;
}>;