(x: A | B)
| 11 | describe('instanceOf', () => { |
| 12 | it('should work at the top level', () => { |
| 13 | const get = (x: A | B): string => |
| 14 | match(x) |
| 15 | .with(P.instanceOf(A), (x) => { |
| 16 | type t = Expect<Equal<typeof x, A>>; |
| 17 | return 'instance of A'; |
| 18 | }) |
| 19 | .with(P.instanceOf(B), (x) => { |
| 20 | type t = Expect<Equal<typeof x, B>>; |
| 21 | return 'instance of B'; |
| 22 | }) |
| 23 | .exhaustive(); |
| 24 | |
| 25 | expect(get(new A())).toEqual('instance of A'); |
| 26 | expect(get(new B())).toEqual('instance of B'); |
no test coverage detected