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(entity): add default options to entity adapter when undefined is passed #3287

Merged

Conversation

markostanimirovic
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?

const {
  selectId, // selectId is undefined instead of the default id selector
  sortComparer, // sortComparer is undefined instead of false
} = createEntityAdapter<Entity>({
  selectId: undefined,
  sortComparer: undefined,
});

What is the new behavior?

const {
  selectId, // selectId is equal to default id selector
  sortComparer, // sortComparer is false
} = createEntityAdapter<Entity>({
  selectId: undefined,
  sortComparer: undefined,
});

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@netlify
Copy link

netlify bot commented Jan 11, 2022

✔️ Deploy Preview for ngrx-io canceled.
Built without sensitive environment variables

🔨 Explore the source changes: 79c2e97

🔍 Inspect the deploy log: https://app.netlify.com/sites/ngrx-io/deploys/61de0c9dc61f3f000858aab4

@ngrxbot
Copy link
Collaborator

ngrxbot commented Jan 11, 2022

Preview docs changes for 79c2e97 at https://previews.ngrx.io/pr3287-79c2e97b/

Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

TIL, I thought that this wasn't allowed with TS (either by default or with strict).
But to enable this, you have to enable the exactOptionalPropertyTypes option.

@brandonroberts brandonroberts merged commit 17fe494 into ngrx:master Jan 17, 2022
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