Created
May 19, 2023 09:04
-
-
Save lautarodragan/4250d9bcc4934afafd49ba75db9ae6a8 to your computer and use it in GitHub Desktop.
DeepReadonly
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
type DeepReadonly<T> = { | |
readonly [P in keyof T]: T[P] extends Record<string, unknown> | |
? DeepReadonly<T[P]> | |
: T[P]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment