Skip to content

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 20, 2025

Bumps ts-pattern from 5.5.0 to 5.6.1.

Release notes

Sourced from ts-pattern's releases.

v5.6.1

What's Changed

Full Changelog: gvergnaud/ts-pattern@v5.6.0...v5.6.1

v5.6.0

This release contains two changes:

Typecheck pattern when using isMatching with 2 parameter.

It used to be possible to pass a pattern than could never match to isMatching. The new version checks that the provide pattern does match the value in second parameter:

type Pizza = { type: 'pizza'; topping: string };
type Sandwich = { type: 'sandwich'; condiments: string[] };
type Food = Pizza | Sandwich;
const fn = (food: Pizza | Sandwich) => {
if (isMatching({ type: 'oops' }, food)) {
//                  👆 used to type-check, now doesn't!
}
}

Do not use P.infer as an inference point

When using P.infer<Pattern> to type a function argument, like in the following example:

const getWithDefault = <T extends P.Pattern>(
  input: unknown,
  pattern: T,
  defaultValue: P.infer<T> //  👈
): P.infer<T> =>
  isMatching(pattern, input) ? input : defaultValue

TypeScript could get confused and find type errors in the wrong spot:

const res = getWithDefault(null, { x: P.string }, 'oops') 
//                                     👆           👆 type error should be here
//                                 but it's here 😬

This new version fixes this problem.

... (truncated)

Commits
  • c415e0c Merge pull request #305 from gvergnaud/gvergnaud/fix-is-matching-union
  • 2be1c5c 5.6.1
  • 5395d5f fix(isMatching): Allow unknown properties in pattern
  • 34f7a41 readme: improvements
  • 844edf3 readme: improvements
  • 246f4d7 doc: add missing docstrings
  • 979d114 jsr: release v5.6.0
  • d68fbcf 5.6.0
  • e35de42 fix: prevent NoInfer from showing up in display types
  • 514057f Merge pull request #289 from gvergnaud/dependabot/npm_and_yarn/rollup-2.79.2
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually 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)

Bumps [ts-pattern](https://github.com/gvergnaud/ts-pattern) from 5.5.0 to 5.6.1.
- [Release notes](https://github.com/gvergnaud/ts-pattern/releases)
- [Commits](gvergnaud/ts-pattern@v5.5.0...v5.6.1)

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

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Jan 20, 2025
@fendor fendor merged commit b0d89ff into master Jan 20, 2025
12 of 13 checks passed
@dependabot dependabot bot deleted the dependabot/npm_and_yarn/ts-pattern-5.6.1 branch January 20, 2025 08:38
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.

1 participant