1
我有这样的事情的打字稿区分联合类型?所有对象成员
我有这样的事情的打字稿区分联合类型?所有对象成员
我不知道是否有更干净的方式来做到这一点,但它在技术上是可行的。
function f<T>(o: {[key: string]: T}): T {
return undefined!;
}
const garbage = f(MapDispatchToProps);
export type ActionsType = typeof garbage;
凝结(只要我能管理):
const garbage = (<T>(o: {[key: string]: T}): T => undefined!)(MapDispatchToProps);
export type ActionsType = typeof garbage;