(set: Set<string | number>)
| 4 | describe('Set', () => { |
| 5 | it('should match Set patterns', () => { |
| 6 | const containsGabAndYo = (set: Set<string | number>) => |
| 7 | match<Set<string | number>, [boolean, boolean]>(set) |
| 8 | .with(P.set('gab'), (x) => { |
| 9 | type t = Expect<Equal<typeof x, Set<'gab'>>>; |
| 10 | return [true, false]; |
| 11 | }) |
| 12 | .with(P.set('yo'), (x) => { |
| 13 | type t = Expect<Equal<typeof x, Set<'yo'>>>; |
| 14 | return [false, true]; |
| 15 | }) |
| 16 | .with(P.set(P.union('gab', 'yo')), (x) => { |
| 17 | type t = Expect<Equal<typeof x, Set<'gab' | 'yo'>>>; |
| 18 | return [true, true]; |
| 19 | }) |
| 20 | .with(P._, (x) => { |
| 21 | type t = Expect<Equal<typeof x, Set<string | number>>>; |
| 22 | return [false, false]; |
| 23 | }) |
| 24 | .run(); |
| 25 | |
| 26 | expect(containsGabAndYo(new Set(['gab', 'yo']))).toEqual([true, true]); |
| 27 | expect(containsGabAndYo(new Set(['gab']))).toEqual([true, false]); |
no test coverage detected
searching dependent graphs…