Skip to content

Bump ts-pattern from 4.3.0 to 5.7.1#53

Closed
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/npm_and_yarn/ts-pattern-5.7.1
Closed

Bump ts-pattern from 4.3.0 to 5.7.1#53
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/npm_and_yarn/ts-pattern-5.7.1

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jun 1, 2025

Bumps ts-pattern from 4.3.0 to 5.7.1.

Release notes

Sourced from ts-pattern's releases.

v5.7.1

Type inference bug fixes

This new release fixes the following bug in exhaustiveness checking when matching on optional properties:

type Input = { type?: 'one' } | { type: 'two' };
const f1 = (input: Input) =>
match(input)
.with({ type: 'one' }, () => {})
.with({ type: 'two' }, () => {})
.exhaustive(); // shouldn't type-check, but does 👎
const f2 = (input: Input) =>
match(input)
.with({ type: 'one' }, () => {})
.with({ type: 'two' }, () => {})
.with({ type: undefined }, () => {}) // <- the type key needs to be present.
.exhaustive();  // shouldn't type-check, but does 👎

These two cases don't type check anymore. They fail with a NonExhaustiveError<{ type?: undefined; }>. To fix it, you should do:

type Input = { type?: 'one' } | { type: 'two' };
const f = (input: Input) =>
match(input)
.with({ type: 'one' }, () => {})
.with({ type: 'two' }, () => {})
.with({ type: P.optional(undefined) }, () => {}) // <- the type property may not be there
.exhaustive(); // ✅

This is a purely type-level change, the runtime behavior is still the same.

What's Changed

Full Changelog: gvergnaud/ts-pattern@v5.7.0...v5.7.1

v5.7.0

New feature

Exhaustive callback

By default, .exhaustive() will throw an error if the input value wasn't handled by any .with(...) clause. This should only happen if your types are incorrect.

... (truncated)

Commits
  • 8517f7f Merge pull request #319 from gvergnaud/gvergnaud/fix-exhaustive-on-optional-p...
  • c744b01 jsr: release 5.7.1
  • e9286fe revert unused imports
  • 72927ca 5.7.1
  • a77e69a fix(.exhaustive): optional discriminant
  • 03e8898 Update README.md
  • 60af216 Merge pull request #253 from gvergnaud/gvergnaud/add-exhaustive-fallback-support
  • 890edfe 5.7.0
  • f58dc67 feat(.exhaustive): improve docstring
  • 1f8e197 feat(.exhaustive): fix docstrings
  • Additional commits viewable in compare view

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code labels Jun 1, 2025
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/ts-pattern-5.7.1 branch from 8fb9c21 to 2b27122 Compare June 16, 2025 16:56
Bumps [ts-pattern](https://github.com/gvergnaud/ts-pattern) from 4.3.0 to 5.7.1.
- [Release notes](https://github.com/gvergnaud/ts-pattern/releases)
- [Commits](gvergnaud/ts-pattern@v4.3.0...v5.7.1)

---
updated-dependencies:
- dependency-name: ts-pattern
  dependency-version: 5.7.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/ts-pattern-5.7.1 branch from 2b27122 to 41da499 Compare June 16, 2025 17:01
@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Aug 1, 2025

Superseded by #57.

@dependabot dependabot bot closed this Aug 1, 2025
@dependabot dependabot bot deleted the dependabot/npm_and_yarn/ts-pattern-5.7.1 branch August 1, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants