-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
188352f
commit 7539a62
Showing
6 changed files
with
31 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export type DeepReadonly<T> = T extends (infer R)[] | ||
? DeepReadonlyArray<R> | ||
: T extends Function | ||
? T | ||
: T extends Set<infer V> | ||
? ReadonlySet<DeepReadonly<V>> | ||
: T extends Map<infer K, infer V> | ||
? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> | ||
: T extends object | ||
? DeepReadonlyObject<T> | ||
: T; | ||
|
||
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {} | ||
|
||
type DeepReadonlyObject<T> = { | ||
readonly [P in keyof T]: DeepReadonly<T[P]>; | ||
}; |