Closed NoMoreViolence closed 5 years ago
Hey @NoMoreViolence, please provide detailed error and minimal reproduction repository only then I'll be able to help you
@piotrwitek
import { createStandardAction } from 'typesafe-actions';
enum UserActionTypes {
LOGIN = 'LOGIN'
}
export interface LoginPayload {
email: string;
password: string;
}
// ERROR
export const userActions = {
login: createStandardAction(UserActionTypes.LOGIN)<LoginPayload>(),
}
// WORKED
export const userActions = {
login: createStandardAction('LOGIN')<LoginPayload>(),
}
TypeError: Cannot read property 'LOGIN' of undefined
in create react app compiler
I don't think it's related to typesafe-actions
. Have you used a debugger to check UserActionTypes value?
You were right, It's about typescript compile, I will close this issue.
First of all checkout our gitter channel: https://gitter.im/react-redux-typescript-guide/typesafe-actions
Then please use Stack Overflow or other resources for help resolving your specific use-cases.
The only exceptions to use issue tracker for questions would be for some unusual "special cases".
I am using this library with react. (create-reactapp) I don't know why can't insertion enum type to createStandartAction
enum UserActionTypes { LOGIN = 'LOGIN' };
interface LoginPayload { aa: string; bb: string; };
// ERROR in create react app const loginAction = createStandardAction(UserActionTypes.LOGIN)();