Skip to content

Instantly share code, notes, and snippets.

@mieszko4
Created December 13, 2020 12:49
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 mieszko4/e322f00ab8ccdcff8ae5ee7921526f6d to your computer and use it in GitHub Desktop.
Save mieszko4/e322f00ab8ccdcff8ae5ee7921526f6d to your computer and use it in GitHub Desktop.
Confused TypeScript
type A = {a: 'a'} | {b: 'b'};
const c: A = {
a: 'a',
b: 'b'
};
type C = typeof c; // === A
// Confused TS: I cannot access c.a nor c.b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment