We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
enum E { A, B, C, } function f(x: E | undefined) { return x ?? E.C; }
Expected f to have type E, but instead it has type E | E.C
f
E
E | E.C
Playground
Doesn't have anything to do with ?? - can reproduce it with ||.
??
||
enum E { A = 1, B, C, } function f(x: E | undefined) { return x || E.C; }