-
-
Save CheatEx/75e9192ee7bc8fbd289b52c9caa960d1 to your computer and use it in GitHub Desktop.
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
class Message { | |
greeting: string; | |
body: string; | |
data: number; | |
} | |
function doActualStuff(g: Message & { name: string; }): void { | |
console.log(g.name); | |
} | |
let m: Message = {greeting: "hey", body: "im a message", data: 42}; | |
let g = { | |
...m, | |
name: "Vasya", | |
anotherFieldNeededElsewhere: true, | |
}; | |
doActualStuff(g); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment