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(store): use strict projectors for createFeature selectors #3799

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?

Closes #3740

What is the new behavior?

Projector function arguments of selectors generated by createFeature are strongly typed.

Does this PR introduce a breaking change?

[x] Yes
[ ] No

BREAKING CHANGES:

Projectors of selectors generated by createFeature are strongly typed.

BEFORE:

Projector function arguments of selectors generated by createFeature are not strongly typed:

const counterFeature = createFeature({
  name: 'counter',
  reducer: createReducer({ count: 0 }),
});

counterFeature.selectCount.projector
// type: (...args: any[]) => number

AFTER:

Projector function arguments of selectors generated by createFeature are strongly typed:

const counterFeature = createFeature({
  name: 'counter',
  reducer: createReducer({ count: 0 }),
});

counterFeature.selectCount.projector
// type: (featureState: { count: number; }) => number

@netlify
Copy link

netlify bot commented Mar 16, 2023

Deploy Preview for ngrx-io ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e8a4a4e
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/64302675db693600087035c5
😎 Deploy Preview https://deploy-preview-3799--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/store/create-feature-strict-projectors branch from 9af7ec1 to a68cad2 Compare March 16, 2023 12:24
Closes ngrx#3740

BREAKING CHANGES:

Projectors of selectors generated by createFeature are strongly typed.

BEFORE:

Projector function arguments of selectors generated by createFeature are not strongly typed:

```ts
const counterFeature = createFeature({
  name: 'counter',
  reducer: createReducer({ count: 0 }),
});

counterFeature.selectCount.projector
// type: (...args: any[]) => number
```

AFTER:

Projector function arguments of selectors generated by createFeature are strongly typed:

```ts
const counterFeature = createFeature({
  name: 'counter',
  reducer: createReducer({ count: 0 }),
});

counterFeature.selectCount.projector
// type: (featureState: { count: number; }) => number
```
@markostanimirovic markostanimirovic force-pushed the feat/store/create-feature-strict-projectors branch from a68cad2 to e8a4a4e Compare April 7, 2023 14:19
@brandonroberts brandonroberts merged commit bafd121 into ngrx:master Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@ngrx/store: Projector arguments of memoized selectors generated by createFeature are not strongly typed
3 participants