(input: Input)
| 376 | |
| 377 | // select with an object that's a union by union |
| 378 | const f2 = (input: Input) => |
| 379 | match(input) |
| 380 | .with({ value: P.select({ type: P.union('a', 'b') }) }, (x) => { |
| 381 | type t = Expect< |
| 382 | Equal< |
| 383 | typeof x, |
| 384 | { type: 'a'; v: string } | { type: 'b'; v: number } |
| 385 | > |
| 386 | >; |
| 387 | |
| 388 | return x.v; |
| 389 | }) |
| 390 | .with({ value: { type: 'c' } }, () => 'c') |
| 391 | .exhaustive(); |
| 392 | |
| 393 | expect(f({ value: { type: 'a', v: 'hello' } })).toEqual('hello'); |
| 394 | expect(f2({ value: { type: 'a', v: 'hello' } })).toEqual('hello'); |
no test coverage detected