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

fix(store): improve types for string selectors #2174

Merged
merged 4 commits into from
Oct 28, 2019

Conversation

timdeschryver
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #

The string selectors don't have the correct types:

  • Does not infer correctly, it will always(?) infer to any
books = this.store.select('books')
  • Are not type safe
books = this.store.select('books', 'notExistingState')

What is the new behavior?

The new behavior will infer correctly and will throw errors if the state property is missing.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Similar PRs:

/cc @alex-okrushko

@ngrxbot
Copy link
Collaborator

ngrxbot commented Oct 22, 2019

Preview docs changes for 89dd230 at https://previews.ngrx.io/pr2174-89dd230/

@@ -199,7 +199,7 @@ export class StoreRouterConnectingModule {
private setUpStoreStateListener(): void {
this.store
.pipe(
select(this.stateKey),
select(this.stateKey as any),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like router_store needs some typing cleanup :-/

@brandonroberts brandonroberts merged commit 46a8467 into master Oct 28, 2019
@brandonroberts brandonroberts deleted the pr/select-typings branch October 28, 2019 12:31
@timdeschryver
Copy link
Member Author

@macjohnny fyi, we decided to improve the typings

jordanpowell88 pushed a commit to jordanpowell88/platform that referenced this pull request Nov 14, 2019
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.

4 participants