[TypeScript] More specific core-data selector types#41594
Closed
adamziel wants to merge 7 commits into
Closed
Conversation
540fe09 to
5e389ac
Compare
75 tasks
dmsnell
reviewed
Jun 14, 2022
| - _name_ `Name`: Entity name. | ||
| - _recordId_ `GenericRecordKey`: Record's id. | ||
| - _kind_ `K`: Entity kind. | ||
| - _name_ `N`: Entity name. |
Member
There was a problem hiding this comment.
when I mentioned having a different name for the public vs. the internal use of function arguments this is one of the reasons why. we like to have short names internally but K and N are vague to the outside.
we can solve this in the source files by importing * as …
import { …normalImports } from './entity-types';
import type * as ET from './entity.types';
export const doer<Kind extends ET.Kind, Name extends ET.Name>(…) => …
Contributor
Author
There was a problem hiding this comment.
Good point! I just updated this PR @dmsnell
adamziel
commented
Jun 15, 2022
|
|
||
| - _state_ `State`: Data state. | ||
| - _kind_ `Kind`: Entity kind. | ||
| - _kind_ `ET.Kind`: Entity kind. |
Contributor
Author
There was a problem hiding this comment.
It's not ideal that the docs mention both ET.Kind and Kind, but tradeoffs, tradeoffs 🤷
adamziel
commented
Jun 15, 2022
| const boundSelectors = mapValues( | ||
| existingSelectors, | ||
| ( selector ) => ( ...args ) => selector( reduxStore.getState(), ...args ) | ||
| ( selector ) => |
Contributor
Author
There was a problem hiding this comment.
ESLint likes to format code in a different way now and it picked up README.md for some reason
Contributor
Author
|
Closing in favor of #42238 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
This PR narrows down
core-dataselectors type signatures after somewhat general ones were introduced as a first step in #41235.Why?
We want to have autocompletion and TypeScript support for core-data primitives as well as compile-time checks, see #39025 for more context.
Testing Instructions
@noisysocks @sirreal @dmsnell @sarayourfriend