Created
December 1, 2025 02:47
-
-
Save anztrax/cd00a5538912bf7afdf805dc32c03a45 to your computer and use it in GitHub Desktop.
Simple implementation of Readonly + Exclude in Typescript
This file contains hidden or 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 MyReadonly2<T, K extends keyof T = keyof T> = { | |
| readonly [P in K] :T[P] | |
| } & { | |
| [P in keyof T as P extends K ? never : P] : T[P] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment