-
-
Notifications
You must be signed in to change notification settings - Fork 2k
docs(store): add note about using createFeatureSelector with no generic supplied to Store #3063
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
Merged
brandonroberts
merged 3 commits into
ngrx:master
from
david-shortman:update-createFeatureSelector-docs
Jul 7, 2021
Merged
docs(store): add note about using createFeatureSelector with no generic supplied to Store #3063
brandonroberts
merged 3 commits into
ngrx:master
from
david-shortman:update-createFeatureSelector-docs
Jul 7, 2021
Conversation
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
…ic supplied to`Store`
Preview docs changes for 88b9fde at https://previews.ngrx.io/pr3063-88b9fde3/ |
brandonroberts
requested changes
Jul 5, 2021
david-shortman
commented
Jul 7, 2021
Comment on lines
-251
to
+253
When injecting `Store` into components and other injectables, it is possible to omit the generic type. If injected without the generic, the default generic is applied as follows `Store<T = object>`. | ||
The most common way to select information from the store is to use a selector function defined with `createSelector`. TypeScript is able to automatically infer types from `createSelector`, which reduces the need to provide the shape of the state to `Store` via a generic argument. | ||
|
||
The most common way to select information from the store is to use a selector function defined with `createSelector`. When doing so, TypeScript is able to automatically infer types from the selector function, therefore reducing the need to define the type in the store generic. | ||
So, when injecting `Store` into components and other injectables, the generic type can be omitted. If injected without the generic, the default generic applied is `Store<T = object>`. |
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.
- removed use of passive voice
- placed motivation to use
Store
without type generic at beginning of section
brandonroberts
approved these changes
Jul 7, 2021
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.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Closes #2780
What is the new behavior?
Added doc explaining usage of
createFeatureSelector
withStore
Does this PR introduce a breaking change?
Other information