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

feat: convert entity and router selectors interfaces to types #3853

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?

[ ] Bugfix
[x] 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?

Interfaces EntitySelectors and RouterStateSelectors are not compatible with Record<string, Selector> which is expected as createSelector.extraSelectors result. For example, we cannot add entity selectors to a specific feature in the following way:

export const productsFeature = createFeature({
  name: 'products',
  reducer: createReducer(initialState),
  extraSelectors: ({ selectProductsState }) =>
    adapter.getSelectors(selectProductsState) // compilation error
  ),
});

Workaround:

  extraSelectors: ({ selectProductsState }) => ({
    ...adapter.getSelectors(selectProductsState),
  }),

What is the new behavior?

Types EntitySelectors and RouterStateSelectors are compatible with Record<string, Selector> and there is no compilation error in the example above.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@netlify
Copy link

netlify bot commented Apr 20, 2023

Deploy Preview for ngrx-io ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6d62ea3
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/6446f601f0dd7000086068e4
😎 Deploy Preview https://deploy-preview-3853--ngrx-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@markostanimirovic markostanimirovic force-pushed the feat/entity-router-selectors-type branch from 59f2c46 to 6d62ea3 Compare April 24, 2023 21:34
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.

Thanks for the added tests!

@brandonroberts brandonroberts merged commit 73eb55c into ngrx:master Apr 25, 2023
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