store
store copied to clipboard
2.0.0-rc.0 : Type StateContext has no property 'dispatch' and no string index signature
I am getting following compile time error with 2.0.0-rc.0
ERROR in libs/auth/src/auth.state.ts(64,43): error TS2459: Type 'StateContext<AuthStateModel>' has no property 'dispatch' and no string index signature.
I don't see dispatch method on StateContext. Am i doing anything working ?
@Action(ChangeAuthMode)
async changeAuthMode({ state, setState, dispatch }: StateContext<AuthStateModel>, { payload }: ChangeAuthMode) {
if (state.authMode !== payload) {
switch (payload) {
case AuthMode.PasswordFlow:
this.oauthService.configure(authConfigPassword);
break;
default:
this.oauthService.configure(authConfigImplicit);
break;
}
await this.oauthService.loadDiscoveryDocument();
return dispatch(new AuthModeChanged(payload));
}
}
@xmlking I THINK it is because of your switch statement. if you take that out do you still see the issue?
I've used dispatch today but without using the StateContext type annotation.
StateContext interface is missing dispatch
https://github.com/amcdnl/ngxs/blob/master/src/symbols.ts#L13
Fixed in rc1