Open renovate[bot] opened 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
nitic-astronomy-website | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Aug 11, 2024 10:02pm |
This PR contains the following updates:
4.3.0
->5.3.1
Release Notes
gvergnaud/ts-pattern (ts-pattern)
### [`v5.3.1`](https://togithub.com/gvergnaud/ts-pattern/releases/tag/v5.3.1) [Compare Source](https://togithub.com/gvergnaud/ts-pattern/compare/b2e7566e1906068cba911825f27d76e6d53fc6c2...v5.3.1) #### Pattern-matching on symbol keys Symbols used to be ignored in object patterns. They are now taken into account: ```ts const symbolA = Symbol('symbol-a'); const symbolB = Symbol('symbol-b'); const obj = { [symbolA]: { [symbolB]: 'foo' } }; if (isMatching({ [symbolA]: { [symbolB]: 'bar' } }, obj)) { // 👆 Used to return true, now returns false! // Since TS-Pattern wasn't reading symbols, this pattern used to be equivalent // to the `{}` pattern that matches any value except null and undefined. } ``` #### `.exhaustive` now throws a custom error People have expressed the need to differentiate runtime errors that `.exhaustive()` might throw when the input is of an unexpected type from other runtime errors that could have happened in the same match expression. It's now possible with `err instanceof NonExhaustiveError`: ```ts import { match, P, NonExhaustiveError } from 'ts-pattern'; const fn = (input: string | number) => { return match(input) .with(P.string, () => "string!") .with(P.number, () => "number!") .exhaustive() } try { fn(null as string) // 👈 💥 } catch (e) { if (e instanceof NonExhaustiveError) { // The input was invalid } else { // something else happened } } ``` #### What's Changed - build(deps-dev): bump braces from 3.0.2 to 3.0.3 in /examples/gif-fetcher by [@dependabot](https://togithub.com/dependabot) in [https://github.com/gvergnaud/ts-pattern/pull/262](https://togithub.com/gvergnaud/ts-pattern/pull/262) - feat: throw custom `ExhaustiveError` when no matched pattern by [@adamhamlin](https://togithub.com/adamhamlin) in [https://github.com/gvergnaud/ts-pattern/pull/270](https://togithub.com/gvergnaud/ts-pattern/pull/270) - Symbols as keys by [@Ayc0](https://togithub.com/Ayc0) in [https://github.com/gvergnaud/ts-pattern/pull/272](https://togithub.com/gvergnaud/ts-pattern/pull/272) #### New Contributors - [@adamhamlin](https://togithub.com/adamhamlin) made their first contribution in [https://github.com/gvergnaud/ts-pattern/pull/270](https://togithub.com/gvergnaud/ts-pattern/pull/270) - [@Ayc0](https://togithub.com/Ayc0) made their first contribution in [https://github.com/gvergnaud/ts-pattern/pull/272](https://togithub.com/gvergnaud/ts-pattern/pull/272) **Full Changelog**: https://github.com/gvergnaud/ts-pattern/compare/v5.2.0...v5.3.1 ### [`v5.3.0`](https://togithub.com/gvergnaud/ts-pattern/compare/v5.2.0...b2e7566e1906068cba911825f27d76e6d53fc6c2) [Compare Source](https://togithub.com/gvergnaud/ts-pattern/compare/v5.2.0...b2e7566e1906068cba911825f27d76e6d53fc6c2) ### [`v5.2.0`](https://togithub.com/gvergnaud/ts-pattern/releases/tag/v5.2.0) [Compare Source](https://togithub.com/gvergnaud/ts-pattern/compare/v5.1.2...v5.2.0) #### The main thing ##### new `P.string.length(n)` pattern `P.string.length(len)` matches strings with exactly `len` characters. ```ts const fn = (input: string) => match(input) .with(P.string.length(2), () => '🎉') .otherwise(() => '❌'); console.log(fn('ok')); // logs '🎉' ``` #### What's Changed - docs: fix typo in `P.when` patterns code example by [@grigorischristainas](https://togithub.com/grigorischristainas) in [https://github.com/gvergnaud/ts-pattern/pull/260](https://togithub.com/gvergnaud/ts-pattern/pull/260) - feat: Added P.string.length by [@JUSTIVE](https://togithub.com/JUSTIVE) in [https://github.com/gvergnaud/ts-pattern/pull/257](https://togithub.com/gvergnaud/ts-pattern/pull/257) #### New Contributors - [@grigorischristainas](https://togithub.com/grigorischristainas) made their first contribution in [https://github.com/gvergnaud/ts-pattern/pull/260](https://togithub.com/gvergnaud/ts-pattern/pull/260) **Full Changelog**: https://github.com/gvergnaud/ts-pattern/compare/v5.1.2...v5.2.0 ### [`v5.1.2`](https://togithub.com/gvergnaud/ts-pattern/releases/tag/v5.1.2) [Compare Source](https://togithub.com/gvergnaud/ts-pattern/compare/v5.1.1...v5.1.2) ##### 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: ```ts 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](https://togithub.com/dependabot) in [https://github.com/gvergnaud/ts-pattern/pull/243](https://togithub.com/gvergnaud/ts-pattern/pull/243) - build(deps): bump loader-utils and react-scripts in /examples/gif-fetcher by [@dependabot](https://togithub.com/dependabot) in [https://github.com/gvergnaud/ts-pattern/pull/242](https://togithub.com/gvergnaud/ts-pattern/pull/242) - build(deps): bump jsdom and react-scripts in /examples/gif-fetcher by [@dependabot](https://togithub.com/dependabot) in [https://github.com/gvergnaud/ts-pattern/pull/241](https://togithub.com/gvergnaud/ts-pattern/pull/241) - build(deps): bump tough-cookie and react-scripts in /examples/gif-fetcher by [@dependabot](https://togithub.com/dependabot) in [https://github.com/gvergnaud/ts-pattern/pull/240](https://togithub.com/gvergnaud/ts-pattern/pull/240) - build(deps): bump shell-quote and react-scripts in /examples/gif-fetcher by [@dependabot](https://togithub.com/dependabot) in [https://github.com/gvergnaud/ts-pattern/pull/239](https://togithub.com/gvergnaud/ts-pattern/pull/239) - chore: add P.map specific jsdoc for P.map by [@momentiris](https://togithub.com/momentiris) in [https://github.com/gvergnaud/ts-pattern/pull/245](https://togithub.com/gvergnaud/ts-pattern/pull/245) - build(deps-dev): bump ejs from 3.1.9 to 3.1.10 in /examples/gif-fetcher by [@dependabot](https://togithub.com/dependabot) in [https://github.com/gvergnaud/ts-pattern/pull/249](https://togithub.com/gvergnaud/ts-pattern/pull/249) - build(deps-dev): bump ejs from 3.1.9 to 3.1.10 by [@dependabot](https://togithub.com/dependabot) in [https://github.com/gvergnaud/ts-pattern/pull/248](https://togithub.com/gvergnaud/ts-pattern/pull/248) - fix: exhaustive checking with nested P.nonNullable patterns by [@gvergnaud](https://togithub.com/gvergnaud) in [https://github.com/gvergnaud/ts-pattern/pull/252](https://togithub.com/gvergnaud/ts-pattern/pull/252) ##### New Contributors - [@momentiris](https://togithub.com/momentiris) made their first contribution in [https://github.com/gvergnaud/ts-pattern/pull/245](https://togithub.com/gvergnaud/ts-pattern/pull/245) **Full Changelog**: https://github.com/gvergnaud/ts-pattern/compare/v5.1.1...v5.1.2 ### [`v5.1.1`](https://togithub.com/gvergnaud/ts-pattern/releases/tag/v5.1.1) [Compare Source](https://togithub.com/gvergnaud/ts-pattern/compare/v5.1.0...v5.1.1) #### What's Changed - Fix(P.nonNullable): narrowing of unions of objects by [@gvergnaud](https://togithub.com/gvergnaud) in [https://github.com/gvergnaud/ts-pattern/pull/237](https://togithub.com/gvergnaud/ts-pattern/pull/237) **Full Changelog**: https://github.com/gvergnaud/ts-pattern/compare/v5.1.0...v5.1.1 ### [`v5.1.0`](https://togithub.com/gvergnaud/ts-pattern/releases/tag/v5.1.0) [Compare Source](https://togithub.com/gvergnaud/ts-pattern/compare/v5.0.8...v5.1.0) ##### New features ##### `P.nonNullable` wildcard Add a new `P.nonNullable` pattern that will match any value except `null` or `undefined`. ```ts import { match, P } from 'ts-pattern'; const input = null; const output = matchConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ 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.
This PR was generated by Mend Renovate. View the repository job log.