ESLint is not recognizing Partial
of typescript but the compiled module does not give any error.
const initialState: IAuthState = {
authenticated: false,
processing: false,
};
const authReducer = (state: IAuthState = initialState, action: any): IAuthState => {
const State = (newState: Partial<IAuthState>): IAuthState => ({...state, ...newState});
switch (action.type) {
case Actions.SIGN_IN_PROCESS_INITIATED:
return State({processing: true});
case Actions.SIGN_IN_PROCESS_FAILED:
return State({processing: false});
default:
return state;
}
};
I know that this can be suppressed by // eslint-disable-next-line no-undef
but still, I want an explanation for this and a permanent solution so that I dont get this not so error Error.
I had a similar case some time ago and fixed it by installing @typescript-eslint/parser
as devDependency and including it in eslint config:
"extends": [..., "@typescript-eslint/parser"],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With