Created
December 10, 2022 09:33
-
-
Save joanna-liana/de27bfde8cee1a448b2845c3651ba21f to your computer and use it in GitHub Desktop.
`ReadonlyRecord` type - to prevent hacks for mutating record properties, e.g. pushing to arrays or overriding nested props
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 ReadonlyRecord<Record> = { | |
readonly [Key in keyof Record]: ReadonlyRecord<Record[Key]> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment