Skip to content

Instantly share code, notes, and snippets.

@LayZeeDK
Last active September 30, 2018 20:22
Show Gist options
  • Save LayZeeDK/a4b5f835ab87a5767643a5efcca93225 to your computer and use it in GitHub Desktop.
Save LayZeeDK/a4b5f835ab87a5767643a5efcca93225 to your computer and use it in GitHub Desktop.
Property update on immutable object
interface Person {
readonly age: number;
readonly firstName: string;
readonly lastName: string;
}
const bill: Person = {
age: 62,
firstName: 'Bill',
lastName: 'Gates',
};
const olderBill: Person = {
...bill,
age: 63,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment