github gvergnaud/ts-pattern v5.1.2

latest releases: v5.5.0, v5.4.0, v5.3.1...
5 months ago

The main thing

When combining P.nonNullable and P.nullish, you should get an exhaustive pattern matching expression, but the following case was incorrectly considered non-exhaustive:

declare const input: {
  nested: string | number | null | undefined;
};

const res = match(input)
  .with({ nested: P.nonNullable }, (x) => {/* ... */})
  .with({ nested: P.nullish }, (x) => {/* ... */})
  // should type-check
  .exhaustive();

This is fixed now.

What's Changed

  • build(deps): bump postcss and react-scripts in /examples/gif-fetcher by @dependabot in #243
  • build(deps): bump loader-utils and react-scripts in /examples/gif-fetcher by @dependabot in #242
  • build(deps): bump jsdom and react-scripts in /examples/gif-fetcher by @dependabot in #241
  • build(deps): bump tough-cookie and react-scripts in /examples/gif-fetcher by @dependabot in #240
  • build(deps): bump shell-quote and react-scripts in /examples/gif-fetcher by @dependabot in #239
  • chore: add P.map specific jsdoc for P.map by @momentiris in #245
  • build(deps-dev): bump ejs from 3.1.9 to 3.1.10 in /examples/gif-fetcher by @dependabot in #249
  • build(deps-dev): bump ejs from 3.1.9 to 3.1.10 by @dependabot in #248
  • fix: exhaustive checking with nested P.nonNullable patterns by @gvergnaud in #252

New Contributors

Full Changelog: v5.1.1...v5.1.2

Don't miss a new ts-pattern release

NewReleases is sending notifications on new releases.