type ReturnTypes = { [key in keyof EnumTypes]: key } export function createTypes (enumTypes: EnumTypes): ReturnTypes { // @FIXME temporarily not use Proxy to avoid schedule screenshot error for not support ES6 Proxy // return new Proxy(enumTypes as any, { // get (_, property: any) { // return enumTypes[property] // } // }) return Object.entries(enumTypes as any).reduce((obj, [key, value]) => ({ ...obj, [key]: value }), {}) as ReturnTypes } type ActionCreatorMap = { [key in keyof ActionMap]: (arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any) => ActionMap[key] } type ValueOf = ActionMap[keyof ActionMap] export function returnType (actions: ActionCreatorMap) { type Action = ValueOf return {} as any as Action }