Skip to content

Instantly share code, notes, and snippets.

@hhyyg
Created November 27, 2018 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhyyg/f74b5a215487f1a49d9a5788f745ef4f to your computer and use it in GitHub Desktop.
Save hhyyg/f74b5a215487f1a49d9a5788f745ef4f to your computer and use it in GitHub Desktop.
TypeScript Immutable and Copy
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