Download next.js/packages/next/src/shared/lib/deep-readonly.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 409 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/deep-readonly.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/shared/lib/deep-readonly.ts
-
curl -L -o deep-readonly.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/deep-readonly.ts
409 Bytes
| /** | |
| * A type that represents a deeply readonly object. This is similar to | |
| * TypeScript's `Readonly` type, but it recursively applies the `readonly` | |
| * modifier to all properties of an object and all elements of arrays. | |
| */ | |
| export type DeepReadonly<T> = T extends (infer R)[] | |
| ? ReadonlyArray<DeepReadonly<R>> | |
| : T extends object | |
| ? { | |
| readonly [K in keyof T]: DeepReadonly<T[K]> | |
| } | |
| : T | |