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
Error says loading is missing. Error doesn't exist if i type RootState without ExtraModels like inside EFFECTS: export type RootState = RematchRootState<RootModel>, but this is not true (i have extra plugin -> loading)
I think createModel should accept type not only RootModel, but also FullModel, it will satisfy state (seconds parameter) from model effect.
I mean this:
effect:{
myMethod: (payload, state <--THIS ONE){
const sth = mySelector(state); // <-- not working, state is not satisfied, mySelector need RootState, but state here is equal to RematchRootState<RootModel, Record<string, never>>.
State should be typed as RematchRootState<RootModel, FullMode> probably
}
}
To Reproduce
Create store with LOADING plugin
Create example model and example selector (like const mySelector = (state:RootState) => sth.
Try tu use selector inside model effect.
The text was updated successfully, but these errors were encountered:
filip-lipinski-tsh
changed the title
TS error while using selectors inside model (with plugin like loading)
TS error while using selectors inside model effects (with plugin like loading)
Nov 21, 2022
I have store configured the same as is in documentation: https://rematchjs.bootcss.com/docs/plugins/loading/, it is:
model
which is created:const user = createModel()({...})
Then i cannot use selectors inside a model->effects, because of error
getUserId selector:
export const getUserId = (state: RootState) => getUserData(state).id;
Error says
loading
is missing. Error doesn't exist if i typeRootState
without ExtraModels like inside EFFECTS:export type RootState = RematchRootState<RootModel>
, but this is not true (i have extra plugin -> loading)I think createModel should accept type not only
RootModel
, but alsoFullModel
, it will satisfy state (seconds parameter) from model effect.I mean this:
To Reproduce
The text was updated successfully, but these errors were encountered: