Created
November 27, 2018 00:04
-
-
Save hhyyg/f74b5a215487f1a49d9a5788f745ef4f to your computer and use it in GitHub Desktop.
TypeScript Immutable and Copy
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
interface Person { | |
readonly groupName; | |
readonly name; | |
} | |
const taro: Person = { | |
groupName: "flower", | |
name: "taro", | |
} | |
const hanako: Person = { | |
...taro, | |
name: "hanako", | |
} | |
console.log(taro); | |
console.log(hanako); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment