|
|
|
|
|
by superice
854 days ago
|
|
Oh that’s easy to fake with type narrowing: function expectType<A, B extends A>() {} expectType<never, typeof yourUnion>(); The function call will fail at compile time if yourUnion is anything more than never, which you can use in your else case of if statements that narrow the discriminated union. |
|