ethers.js/packages/properties/src.ts/freezable.ts

13 lines
317 B
TypeScript
Raw Permalink Normal View History

2022-04-11 17:09:17 -04:00
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]>;
}>;