【发布时间】:2021-02-11 07:14:25
【问题描述】:
这就是我使用 ActionCreater 及其类型定义动作的方式。
const listRequestAction = new ActionCreator<undefined, undefined>(
REQUEST_LIST
);
type listRequestActionType = ReturnType<
typeof listRequestAction.create
>;
我想为我的操作添加一个动态命名空间,所以我对操作进行了此更改。
const listRequestAction = (namespace: string) =>
new ActionCreator<undefined, undefined>(
`${namespace}${REQUEST_LIST}`
);
如何重新定义 listRequestActionType 以支持命名空间更改?
【问题讨论】:
-
请分享可重现的例子
标签: typescript react-redux typescript-typings