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(example): handle possible undefined results from Dictionary #1745

Merged
merged 1 commit into from
Apr 13, 2019
Merged

fix(example): handle possible undefined results from Dictionary #1745

merged 1 commit into from
Apr 13, 2019

Conversation

alex-okrushko
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

Adjust the example to handle the updated Dictionary, which now types as T | undefined.

[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 #
#1735

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@ngrxbot
Copy link
Collaborator

ngrxbot commented Apr 13, 2019

Preview docs changes for e0614f4 at https://previews.ngrx.io/pr1745-e0614f4/

return searchIds.map(id => books[id]);
return searchIds
.map(id => books[id])
.filter((book): book is Book => book != null);
Copy link
Member

@brandonroberts brandonroberts Apr 13, 2019

Choose a reason for hiding this comment

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

Any reason not to use .filter(Boolean)?

Copy link
Member Author

Choose a reason for hiding this comment

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

.filter(Boolean) doesn't work with strictNullChecks
PLAYGROUND LINK

Screen Shot 2019-04-13 at 3 56 03 PM

@brandonroberts brandonroberts merged commit 861b0cb into ngrx:master Apr 13, 2019
@alex-okrushko alex-okrushko deleted the fix-dict-example branch April 13, 2019 19:57
@alex-okrushko alex-okrushko restored the fix-dict-example branch April 16, 2019 02:24
@alex-okrushko alex-okrushko deleted the fix-dict-example branch October 30, 2019 03:02
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.

3 participants