Skip to content

Instantly share code, notes, and snippets.

@carlrip
Created December 17, 2019 18:17
Show Gist options
  • Save carlrip/4a307997132464c168414a95458269c2 to your computer and use it in GitHub Desktop.
Save carlrip/4a307997132464c168414a95458269c2 to your computer and use it in GitHub Desktop.
Readonly arrays - non readonly array
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