This has been haunting me for some time. When I add a plugin with model to a store, rdx does recognize its reducers and they are not showing up on the store's dispatch
I finally found the issue, which is between the definition of Plugin and how the model is then extracted
export interface Plugin<M extends Model = Model> {
model?: M
}
type KeysOfPluginsWithModels<P extends Plugins> = {
[K in keyof P]: undefined extends ExtractPluginModel<P[K]> ? never : K
}[keyof P]
Because Plugin['model'] is optional, it will always hit the undefined extends ExtractPluginModel<P[K]> condition, regardless of it actually being present on the given plugin.
I have been unable to figure out what is happening. Maybe this is related to another issue I found, and also experienced with TS 4.3+. When installed in the rdx repo, this error shows in effects-config.ts
TS7022: 'testModel' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
This has been haunting me for some time. When I add a plugin with model to a store, rdx does recognize its reducers and they are not showing up on the store's
dispatch
I finally found the issue, which is between the definition of
Plugin
and how the model is then extractedBecause
Plugin['model']
is optional, it will always hit theundefined extends ExtractPluginModel<P[K]>
condition, regardless of it actually being present on the given plugin.I have been unable to figure out what is happening. Maybe this is related to another issue I found, and also experienced with TS 4.3+. When installed in the
rdx
repo, this error shows ineffects-config.ts