(input: { t: 'a'; x: any } | { t: 'b' })
| 215 | |
| 216 | it("when 2 returned values don't match, the error should be at the second returned value", () => { |
| 217 | const f = (input: { t: 'a'; x: any } | { t: 'b' }) => |
| 218 | match<typeof input, string>(input) |
| 219 | .with({ t: 'a', x: 'hello' }, { t: 'a' }, (x) => 'ok') |
| 220 | // @ts-expect-error |
| 221 | .with({ t: 'b' }, (x) => 2) |
| 222 | .run(); |
| 223 | }); |
| 224 | |
| 225 | it('issue #74: inference must work on every pattern in the list', () => { |