Update dependency ts-pattern to ^5.7.1 #9

Open
renovate wants to merge 1 commits from renovate/ts-pattern-5.x into main
Collaborator

This PR contains the following updates:

Package Type Update Change
ts-pattern dependencies patch ^5.7.0 -> ^5.7.1

Release Notes

gvergnaud/ts-pattern (ts-pattern)

v5.7.1

Compare Source

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: https://github.com/gvergnaud/ts-pattern/compare/v5.7.0...v5.7.1


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ts-pattern](https://github.com/gvergnaud/ts-pattern) | dependencies | patch | [`^5.7.0` -> `^5.7.1`](https://renovatebot.com/diffs/npm/ts-pattern/5.7.0/5.7.1) | --- ### Release Notes <details> <summary>gvergnaud/ts-pattern (ts-pattern)</summary> ### [`v5.7.1`](https://github.com/gvergnaud/ts-pattern/releases/tag/v5.7.1) [Compare Source](https://github.com/gvergnaud/ts-pattern/compare/v5.7.0...v5.7.1) #### Type inference bug fixes This new release fixes the following bug in exhaustiveness checking when matching on optional properties: ```ts 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: ```ts 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 - fix(.exhaustive): optional discriminant by [@&#8203;gvergnaud](https://github.com/gvergnaud) in https://github.com/gvergnaud/ts-pattern/pull/319 **Full Changelog**: https://github.com/gvergnaud/ts-pattern/compare/v5.7.0...v5.7.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4xNC42IiwidXBkYXRlZEluVmVyIjoiNDAuMTQuNiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
renovate added 1 commit 2025-05-19 00:07:34 +00:00
Update dependency ts-pattern to ^5.7.1
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
c2ce55af1c
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin renovate/ts-pattern-5.x:renovate/ts-pattern-5.x
git checkout renovate/ts-pattern-5.x
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: pierre/MoneyMgr#9
No description provided.