Last active
September 30, 2018 20:22
-
-
Save LayZeeDK/a4b5f835ab87a5767643a5efcca93225 to your computer and use it in GitHub Desktop.
Property update on immutable object
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
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