-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
refactor(vanilla/types): replace hardcoded types with StoreApi type #1459
Conversation
Add binding of createStoreImpl methods types to StoreApi without hardcoding. Makes it easier to read and reason about where the type comes from and belongs to. Removing arrow function types reduces number of arrows, and makes it easier to read.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b07d80d:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Mentioning @devanshj just in case.
Looks fine to me too. |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`^18.11.10` -> `^18.11.18`](https://renovatebot.com/diffs/npm/@types%2fnode/18.11.10/18.11.18) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.18/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.18/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.18/compatibility-slim/18.11.10)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.18/confidence-slim/18.11.10)](https://docs.renovatebot.com/merge-confidence/) | | [@types/react-dom](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`^18.0.9` -> `^18.0.10`](https://renovatebot.com/diffs/npm/@types%2freact-dom/18.0.9/18.0.10) | [![age](https://badges.renovateapi.com/packages/npm/@types%2freact-dom/18.0.10/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2freact-dom/18.0.10/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2freact-dom/18.0.10/compatibility-slim/18.0.9)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2freact-dom/18.0.10/confidence-slim/18.0.9)](https://docs.renovatebot.com/merge-confidence/) | | [eslint](https://eslint.org) ([source](https://togithub.com/eslint/eslint)) | [`^8.29.0` -> `^8.30.0`](https://renovatebot.com/diffs/npm/eslint/8.29.0/8.30.0) | [![age](https://badges.renovateapi.com/packages/npm/eslint/8.30.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/eslint/8.30.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/eslint/8.30.0/compatibility-slim/8.29.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/eslint/8.30.0/confidence-slim/8.29.0)](https://docs.renovatebot.com/merge-confidence/) | | [prettier](https://prettier.io) ([source](https://togithub.com/prettier/prettier)) | [`^2.8.0` -> `^2.8.1`](https://renovatebot.com/diffs/npm/prettier/2.8.0/2.8.1) | [![age](https://badges.renovateapi.com/packages/npm/prettier/2.8.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/prettier/2.8.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/prettier/2.8.1/compatibility-slim/2.8.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/prettier/2.8.1/confidence-slim/2.8.0)](https://docs.renovatebot.com/merge-confidence/) | | [typescript](https://www.typescriptlang.org/) ([source](https://togithub.com/Microsoft/TypeScript)) | [`^4.9.3` -> `^4.9.4`](https://renovatebot.com/diffs/npm/typescript/4.9.3/4.9.4) | [![age](https://badges.renovateapi.com/packages/npm/typescript/4.9.4/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/typescript/4.9.4/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/typescript/4.9.4/compatibility-slim/4.9.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/typescript/4.9.4/confidence-slim/4.9.3)](https://docs.renovatebot.com/merge-confidence/) | | [vite](https://togithub.com/vitejs/vite/tree/main/#readme) ([source](https://togithub.com/vitejs/vite)) | [`^3.2.4` -> `^3.2.5`](https://renovatebot.com/diffs/npm/vite/3.2.4/3.2.5) | [![age](https://badges.renovateapi.com/packages/npm/vite/3.2.5/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/vite/3.2.5/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/vite/3.2.5/compatibility-slim/3.2.4)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/vite/3.2.5/confidence-slim/3.2.4)](https://docs.renovatebot.com/merge-confidence/) | | [zustand](https://togithub.com/pmndrs/zustand) | [`^4.1.4` -> `^4.1.5`](https://renovatebot.com/diffs/npm/zustand/4.1.4/4.1.5) | [![age](https://badges.renovateapi.com/packages/npm/zustand/4.1.5/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/zustand/4.1.5/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/zustand/4.1.5/compatibility-slim/4.1.4)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/zustand/4.1.5/confidence-slim/4.1.4)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>eslint/eslint</summary> ### [`v8.30.0`](https://togithub.com/eslint/eslint/releases/tag/v8.30.0) [Compare Source](https://togithub.com/eslint/eslint/compare/v8.29.0...v8.30.0) #### Features - [`075ef2c`](https://togithub.com/eslint/eslint/commit/075ef2cf315e75b51b671c40ce9a97c66b2e4b50) feat: add suggestion for no-return-await ([#​16637](https://togithub.com/eslint/eslint/issues/16637)) (Daniel Bartholomae) - [`7190d98`](https://togithub.com/eslint/eslint/commit/7190d98ff40023f24b0c6a98319ae8a82c99ff5b) feat: update globals ([#​16654](https://togithub.com/eslint/eslint/issues/16654)) (Sébastien Règne) #### Bug Fixes - [`1a327aa`](https://togithub.com/eslint/eslint/commit/1a327aae57f1b68c96b27cc1bd57f8198d5a3a7c) fix: Ensure flat config unignores work consistently like eslintrc ([#​16579](https://togithub.com/eslint/eslint/issues/16579)) (Nicholas C. Zakas) - [`9b8bb72`](https://togithub.com/eslint/eslint/commit/9b8bb72c49a453086954b06a5d7dd390731b1975) fix: autofix recursive functions in no-var ([#​16611](https://togithub.com/eslint/eslint/issues/16611)) (Milos Djermanovic) #### Documentation - [`6a8cd94`](https://togithub.com/eslint/eslint/commit/6a8cd94ed08983c70ca7d72dc6e360770a743405) docs: Clarify Discord info in issue template config ([#​16663](https://togithub.com/eslint/eslint/issues/16663)) (Nicholas C. Zakas) - [`ad44344`](https://togithub.com/eslint/eslint/commit/ad44344ef6fdeac7217eb83bc54a230382c0da5e) docs: CLI documentation standardization ([#​16563](https://togithub.com/eslint/eslint/issues/16563)) (Ben Perlmutter) - [`293573e`](https://togithub.com/eslint/eslint/commit/293573eb530d161d2a5b01efd9d3de49dadea022) docs: fix broken line numbers ([#​16606](https://togithub.com/eslint/eslint/issues/16606)) (Sam Chen) - [`fa2c64b`](https://togithub.com/eslint/eslint/commit/fa2c64be10d5854fb586c20957737d7d2da1975a) docs: use relative links for internal links ([#​16631](https://togithub.com/eslint/eslint/issues/16631)) (Percy Ma) - [`75276c9`](https://togithub.com/eslint/eslint/commit/75276c9bc7c4bc013fc6bdf277353c979934d73b) docs: reorder options in no-unused-vars ([#​16625](https://togithub.com/eslint/eslint/issues/16625)) (Milos Djermanovic) - [`7276fe5`](https://togithub.com/eslint/eslint/commit/7276fe5776f03fb90e575ed63a9b1a6766993e42) docs: Fix anchor in URL ([#​16628](https://togithub.com/eslint/eslint/issues/16628)) (Karl Horky) - [`6bef135`](https://togithub.com/eslint/eslint/commit/6bef1350e692c818c55c6d2074c12506e98cdf4f) docs: don't apply layouts to html formatter example ([#​16591](https://togithub.com/eslint/eslint/issues/16591)) (Tanuj Kanti) - [`dfc7ec1`](https://togithub.com/eslint/eslint/commit/dfc7ec11b11b56daaa10e8e6d08c5cddfc8c2c59) docs: Formatters page updates ([#​16566](https://togithub.com/eslint/eslint/issues/16566)) (Ben Perlmutter) - [`8ba124c`](https://togithub.com/eslint/eslint/commit/8ba124cfd8aaf01d14ccbcb1654798624948fb0a) docs: update the `prefer-const` example ([#​16607](https://togithub.com/eslint/eslint/issues/16607)) (Pavel) - [`e6cb05a`](https://togithub.com/eslint/eslint/commit/e6cb05aa35bafb9e88f161ad1fa6b01942a7c13c) docs: fix css leaking ([#​16603](https://togithub.com/eslint/eslint/issues/16603)) (Sam Chen) #### Chores - [`f2c4737`](https://togithub.com/eslint/eslint/commit/f2c47372420f050ad8f2300271345de1c1232635) chore: upgrade [@​eslint/eslintrc](https://togithub.com/eslint/eslintrc)[@​1](https://togithub.com/1).4.0 ([#​16675](https://togithub.com/eslint/eslint/issues/16675)) (Milos Djermanovic) - [`ba74253`](https://togithub.com/eslint/eslint/commit/ba74253e8bd63e9e163bbee0540031be77e39253) chore: standardize npm script names per [#​14827](https://togithub.com/eslint/eslint/issues/14827) ([#​16315](https://togithub.com/eslint/eslint/issues/16315)) (Patrick McElhaney) - [`0d9af4c`](https://togithub.com/eslint/eslint/commit/0d9af4c5674809be993439c766dcd9d7f65fcec9) ci: fix npm v9 problem with `file:` ([#​16664](https://togithub.com/eslint/eslint/issues/16664)) (Milos Djermanovic) - [`90c9219`](https://togithub.com/eslint/eslint/commit/90c9219181e0aadcae7224602d2988186d457113) refactor: migrate off deprecated function-style rules in all tests ([#​16618](https://togithub.com/eslint/eslint/issues/16618)) (Bryan Mishkin) </details> <details> <summary>prettier/prettier</summary> ### [`v2.8.1`](https://togithub.com/prettier/prettier/blob/HEAD/CHANGELOG.md#​281) [Compare Source](https://togithub.com/prettier/prettier/compare/2.8.0...2.8.1) [diff](https://togithub.com/prettier/prettier/compare/2.8.0...2.8.1) ##### Fix SCSS map in arguments ([#​9184](https://togithub.com/prettier/prettier/pull/9184) by [@​agamkrbit](https://togithub.com/agamkrbit)) ```scss // Input $display-breakpoints: map-deep-merge( ( "print-only": "only print", "screen-only": "only screen", "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})", ), $display-breakpoints ); // Prettier 2.8.0 $display-breakpoints: map-deep-merge( ( "print-only": "only print", "screen-only": "only screen", "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, " sm ")-1})", ), $display-breakpoints ); // Prettier 2.8.1 $display-breakpoints: map-deep-merge( ( "print-only": "only print", "screen-only": "only screen", "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})", ), $display-breakpoints ); ``` ##### Support auto accessors syntax ([#​13919](https://togithub.com/prettier/prettier/pull/13919) by [@​sosukesuzuki](https://togithub.com/sosukesuzuki)) Support for [Auto Accessors Syntax](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#auto-accessors-in-classes) landed in TypeScript 4.9. (Doesn't work well with `babel-ts` parser) ```tsx class Foo { accessor foo: number = 3; } ``` </details> <details> <summary>Microsoft/TypeScript</summary> ### [`v4.9.4`](https://togithub.com/microsoft/TypeScript/releases/tag/v4.9.4): TypeScript 4.9.4 [Compare Source](https://togithub.com/Microsoft/TypeScript/compare/v4.9.3...v4.9.4) For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9). For the complete list of fixed issues, check out the - [fixed issues query for Typescript v4.9.4](https://togithub.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=is%3Aissue+milestone%3A%22TypeScript+4.9.4%22+is%3Aclosed+). Downloads are available on: - [npm](https://www.npmjs.com/package/typescript) - [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild) ##### Changes: - [`e286821`](https://togithub.com/Microsoft/TypeScript/commit/e2868216f637e875a74c675845625eb15dcfe9a2) Bump version to 4.9.4 and LKG. - [`eb5419f`](https://togithub.com/Microsoft/TypeScript/commit/eb5419fc8d980859b98553586dfb5f40d811a745) Cherry-pick [#​51704](https://togithub.com/Microsoft/TypeScript/issues/51704) to release 4.9 ([#​51712](https://togithub.com/Microsoft/TypeScript/issues/51712)) - [`b4d382b`](https://togithub.com/Microsoft/TypeScript/commit/b4d382b9b12460adf2da4cc0d1429cf19f8dc8be) Cherry-pick changes for narrowing to tagged literal types. - [`e7a02f4`](https://togithub.com/Microsoft/TypeScript/commit/e7a02f43fce47e1a39259ada5460bcc33c8e98b5) Port of [#​51626](https://togithub.com/Microsoft/TypeScript/issues/51626) and [#​51689](https://togithub.com/Microsoft/TypeScript/issues/51689) to release-4.9 ([#​51627](https://togithub.com/Microsoft/TypeScript/issues/51627)) - [`1727912`](https://togithub.com/Microsoft/TypeScript/commit/1727912f0437a7f367d90040fc4b0b4f3efd017a) Cherry-pick fix around `visitEachChild` to release-4.9. ([#​51544](https://togithub.com/Microsoft/TypeScript/issues/51544)) This list of changes was [auto generated](https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/\_release?releaseId=117&\_a=release-summary). </details> <details> <summary>vitejs/vite</summary> ### [`v3.2.5`](https://togithub.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#small325-2022-12-05-small) [Compare Source](https://togithub.com/vitejs/vite/compare/v3.2.4...v3.2.5) - chore: cherry pick more v4 bug fixes to v3 ([#​11189](https://togithub.com/vitejs/vite/issues/11189)) ([eba9b42](https://togithub.com/vitejs/vite/commit/eba9b42)), closes [#​11189](https://togithub.com/vitejs/vite/issues/11189) [#​10949](https://togithub.com/vitejs/vite/issues/10949) [#​11056](https://togithub.com/vitejs/vite/issues/11056) [#​8663](https://togithub.com/vitejs/vite/issues/8663) [#​10958](https://togithub.com/vitejs/vite/issues/10958) [#​11120](https://togithub.com/vitejs/vite/issues/11120) [#​11122](https://togithub.com/vitejs/vite/issues/11122) [#​11123](https://togithub.com/vitejs/vite/issues/11123) [#​11132](https://togithub.com/vitejs/vite/issues/11132) - chore: cherry pick v4 bug fix to v3 ([#​11110](https://togithub.com/vitejs/vite/issues/11110)) ([c93a526](https://togithub.com/vitejs/vite/commit/c93a526)), closes [#​11110](https://togithub.com/vitejs/vite/issues/11110) [#​10941](https://togithub.com/vitejs/vite/issues/10941) [#​10987](https://togithub.com/vitejs/vite/issues/10987) [#​10985](https://togithub.com/vitejs/vite/issues/10985) [#​11067](https://togithub.com/vitejs/vite/issues/11067) - fix: relocated logger to respect config. ([#​10787](https://togithub.com/vitejs/vite/issues/10787)) ([#​10967](https://togithub.com/vitejs/vite/issues/10967)) ([bc3b5a9](https://togithub.com/vitejs/vite/commit/bc3b5a9)), closes [#​10787](https://togithub.com/vitejs/vite/issues/10787) [#​10967](https://togithub.com/vitejs/vite/issues/10967) </details> <details> <summary>pmndrs/zustand</summary> ### [`v4.1.5`](https://togithub.com/pmndrs/zustand/releases/tag/v4.1.5) [Compare Source](https://togithub.com/pmndrs/zustand/compare/v4.1.4...v4.1.5) This version has several small improvements. #### What's Changed - fix(middleware/devtools): do not use optional catch binding syntax by [@​mskrzypek](https://togithub.com/mskrzypek) in [https://github.com/pmndrs/zustand/pull/1431](https://togithub.com/pmndrs/zustand/pull/1431) - feat(shallow): Add support of Maps and Sets to shallow comparator by [@​anton-lunev](https://togithub.com/anton-lunev) in [https://github.com/pmndrs/zustand/pull/1451](https://togithub.com/pmndrs/zustand/pull/1451) - refactor(vanilla/types): replace hardcoded types with StoreApi type by [@​Arsikod](https://togithub.com/Arsikod) in [https://github.com/pmndrs/zustand/pull/1459](https://togithub.com/pmndrs/zustand/pull/1459) - Fix: Programmatic `module.exports` addition for named and default exports in CJS by [@​barelyhuman](https://togithub.com/barelyhuman) in [https://github.com/pmndrs/zustand/pull/1460](https://togithub.com/pmndrs/zustand/pull/1460) #### New Contributors - [@​wmcb91](https://togithub.com/wmcb91) made their first contribution in [https://github.com/pmndrs/zustand/pull/1398](https://togithub.com/pmndrs/zustand/pull/1398) - [@​chrisvander](https://togithub.com/chrisvander) made their first contribution in [https://github.com/pmndrs/zustand/pull/1426](https://togithub.com/pmndrs/zustand/pull/1426) - [@​boatilus](https://togithub.com/boatilus) made their first contribution in [https://github.com/pmndrs/zustand/pull/1428](https://togithub.com/pmndrs/zustand/pull/1428) - [@​chybisov](https://togithub.com/chybisov) made their first contribution in [https://github.com/pmndrs/zustand/pull/1453](https://togithub.com/pmndrs/zustand/pull/1453) - [@​hicucu](https://togithub.com/hicucu) made their first contribution in [https://github.com/pmndrs/zustand/pull/1438](https://togithub.com/pmndrs/zustand/pull/1438) - [@​mskrzypek](https://togithub.com/mskrzypek) made their first contribution in [https://github.com/pmndrs/zustand/pull/1431](https://togithub.com/pmndrs/zustand/pull/1431) - [@​anton-lunev](https://togithub.com/anton-lunev) made their first contribution in [https://github.com/pmndrs/zustand/pull/1451](https://togithub.com/pmndrs/zustand/pull/1451) - [@​Arsikod](https://togithub.com/Arsikod) made their first contribution in [https://github.com/pmndrs/zustand/pull/1459](https://togithub.com/pmndrs/zustand/pull/1459) **Full Changelog**: pmndrs/zustand@v4.1.4...v4.1.5 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" in timezone Europe/Berlin, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/mheob/ef-calc).
Add binding of createStoreImpl methods types to StoreApi without hardcoding.
Related Issues
In case of changing something in StoreApi type we dont have to change it again inside createStoreImpl
Fixes #.
Summary
Removing arrow function types reduces number of arrows, and makes it easier to read.
Makes it easier to read and reason about where the type comes from and belongs to.
Check List
yarn run prettier
for formatting code and docs