-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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(signals): add signalStore and signalStoreFeature #4049
Conversation
✅ Deploy Preview for ngrx-io canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
58bdb60
to
f1eda7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
); | ||
} | ||
|
||
function withCustomFeatureWithInput<_>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this generic has a meaning?
function withCustomFeatureWithInput<_>() { | |
function withCustomFeatureWithInput() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a weird typing bug when custom features with input are used in complex use cases.
Here is the reproduction. If we remove <_>
from withY
, the compilation error will be thrown in SignalStores that use withY
feature although the generic isn't used anywhere. 👀
This is a rare case, but I'll document this behavior and there will be a recommendation in the docs.
state: type<{ foo: string }>(), | ||
signals: type<{ s: Signal<number> }>(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a question about the usage of type
.
If I understand this correctly, the type
is used here to make the store typesafe? In this case, this feature expects that it's used within a store that has a foo
state property, and a s
signal property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly!
Congrats on closing #4000! 🚀 |
When can we expect release of this? I assume this will be a npm package ngrx/signals? |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Closes #4000
What is the new behavior?
signalStore
andsignalStoreFeature
functions are added to the@ngrx/signals
package.Does this PR introduce a breaking change?