Skip to content

Instantly share code, notes, and snippets.

@fluidsonic
Last active January 9, 2020 12:16
Show Gist options
  • Save fluidsonic/d0c778c6c8fc6fe8c255f730f498b9e6 to your computer and use it in GitHub Desktop.
Save fluidsonic/d0c778c6c8fc6fe8c255f730f498b9e6 to your computer and use it in GitHub Desktop.
interface Foo {
a: number; // no b
}
interface Bar {
a: number; b: string
}
function logB(value: Merge<Foo | Bar>) {
console.log(value.b) // .b is now an optional 'string' property
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment