Closed vegawong closed 6 years ago
Hi, Please show how you create fetchDataSuccess function
export const fetchDataSuccess = createStandardAction(types.FETCH_DATA_SUCCESS)<
PlainObject
>()
I think it's typescript's problem; it can only show the property all the union type has; some action has not payload . so it would show the error. when i change my actions all create as PayloadAction and it work!
I understand, please could you also show contents of entire './actions' module, I could tell you which action could be problematic
this is action & reducer file
@vegawong I think you shouldn't be using never
type, it should be void, can you try it? If you take a look at docs it is always using void.
nothing worked! it also create as EmptyAction
type that only as type
property. it can't work in union type.
but i saw that it work in the sample source, i try to find out that maybe some wrong in my tsconfig
hello! I had found out what's wrong with that? but.... emmmm... I has no idea to deal with. if i did not use constant type from another module,and then actionCreator would get the collect type and it work! like that:
but, when is use the constant from another module, actionCreator can't get the collect type like that:
@piotrwitek oh my god! It is my fault; my constant code like that:
const PAGENAME = 'dzcf/Prescriptions'
export const FETCH_DATA = `${PAGENAME}/fetchData`
export const FETCH_DATA_SUCCESS = `${PAGENAME}/fetchDataSuccess`
I type the code use String Template
and typescript is not suport this way for String Literals
, so that it can't get the right value as type for getType
function. thanks
code like that: my action type like that: it can't get the origin action type via
switch & case
is there any wrong in my code?