v4.0.4
Fixes:
- When nesting
P.array()andP.select(), the handler function used to receiveundefinedinstead of an empty array when the input array was empty. Now it received an empty array as expected:
match([])
.with(P.array({ name: P.select() }), (names) => names) /* names has type `string[]` and value `[]` */
// ...
.exhaustive()- The types used to forbid using an empty array pattern (
[]) when matching on a value of typeunknown. This has been fixed.
const f = (x: unknown) => match(x).with([], () => "this is an empty array!").otherwise(() => "?")Commits: