Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency ts-pattern to v5.6.0 #1091

Merged
merged 1 commit into from
Dec 15, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 15, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
ts-pattern 5.5.0 -> 5.6.0 age adoption passing confidence

Release Notes

gvergnaud/ts-pattern (ts-pattern)

v5.6.0

Compare Source

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.

What's Changed

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


Configuration

📅 Schedule: Branch creation - "after 3am on Sunday" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, 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 was generated by Mend Renovate. View the repository job log.

@renovate renovate bot enabled auto-merge (rebase) December 15, 2024 20:33
@renovate renovate bot enabled auto-merge (rebase) December 15, 2024 20:36
@renovate renovate bot force-pushed the renovate/ts-pattern-5.x branch 2 times, most recently from 0e069ad to 4ab46de Compare December 15, 2024 20:38
@github-actions github-actions bot force-pushed the renovate/ts-pattern-5.x branch from 4ab46de to 889905d Compare December 15, 2024 20:38
@renovate renovate bot force-pushed the renovate/ts-pattern-5.x branch from 889905d to 6f94486 Compare December 15, 2024 20:43
@github-actions github-actions bot force-pushed the renovate/ts-pattern-5.x branch from 6f94486 to 8801e7e Compare December 15, 2024 20:44
@renovate renovate bot merged commit 15a7fda into main Dec 15, 2024
1 check passed
@renovate renovate bot deleted the renovate/ts-pattern-5.x branch December 15, 2024 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants