Skip to content

Instantly share code, notes, and snippets.

@lautarodragan
Created May 19, 2023 09:04
Show Gist options
  • Save lautarodragan/4250d9bcc4934afafd49ba75db9ae6a8 to your computer and use it in GitHub Desktop.
Save lautarodragan/4250d9bcc4934afafd49ba75db9ae6a8 to your computer and use it in GitHub Desktop.
DeepReadonly
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