Created
December 17, 2019 18:17
-
-
Save carlrip/4a307997132464c168414a95458269c2 to your computer and use it in GitHub Desktop.
Readonly arrays - non readonly array
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 Person = { | |
readonly name: string; | |
readonly scores: number[]; | |
} | |
const bob: Person = { | |
name: "Bob", | |
scores: [50, 45] | |
} | |
bob.scores.push(60); // does this raise a type error? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment