You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `type` property of the definition should be the same constant used for reducer definitions to be handled by this creator. To avoid collision, we recommend using Symbols for this. It's also used for defining/retrieving types - see [Typescript](#typescript).
@@ -506,7 +506,7 @@ The Typescript system for custom slice creators uses a "creator registry" system
506
506
Creators are registered by using module augmentation to add a new key (their unique `type`) to the `SliceReducerCreators` interface. The interface receives three type parameters (`State`, `CaseReducers` and `Name`), and each entry should use the `ReducerCreatorEntry` type utility.
@@ -548,7 +548,7 @@ Assuming the creator is called as `create.yourCreator()`, the `this` value for t
548
548
However, this should be specifically included in the function signature, so Typescript can warn if called with an incorrect context (for example, if the user destructures from the `create` value).
@@ -587,7 +587,7 @@ The second argument to the `ReducerCreators` type is a map from creator names to
587
587
Sometimes it's useful to have a reducer creator that only works with a specific state shape. You can ensure the creator is only callable if the state matches, using a conditional type:
@@ -614,7 +614,7 @@ Any creators that evaluate to the `never` type are omitted from the final `creat
614
614
An alternative would be just using that required type _as_ the `State` type for the reducer definitions, so Typescript then complains when the creator is used.
0 commit comments