= () => { type: T }\n>(\n actionType: T,\n actionResolverHandler?: (\n resolve: (\n payload?: P,\n meta?: M\n ) => PayloadMetaAction\n ) => AC\n): AC {\n validateActionType(actionType);\n\n const actionCreator: AC =\n actionResolverHandler == null\n ? ((() => action(actionType)) as AC)\n : actionResolverHandler(action.bind(null, actionType) as any);\n\n return Object.assign(actionCreator, {\n getType: () => actionType,\n // redux-actions compatibility\n toString: () => actionType,\n });\n}\n","import { StringType, Box, FsaBuilder, FsaMapBuilder } from './types';\nimport { createActionWithType } from './create-action-with-type';\nimport { validateActionType } from './utils';\n\nexport interface CreateStandardAction {\n (): FsaBuilder, Box>;\n map(\n fn: (payload: P, meta: M) => R\n ): FsaMapBuilder, Box, Box>;\n}\n\n/**\n * @description create an action-creator of a given function that contains hidden \"type\" metadata\n */\nexport function createStandardAction(\n actionType: T\n): CreateStandardAction {\n validateActionType(actionType);\n\n function constructor(): FsaBuilder, Box> {\n return createActionWithType(actionType, type => (payload: P, meta: M) => ({\n type,\n payload,\n meta,\n })) as FsaBuilder, Box>;\n }\n\n function map(\n fn: (payload: P, meta: M) => R\n ): FsaMapBuilder, Box, Box> {\n return createActionWithType(actionType, type => (payload: P, meta: M) =>\n Object.assign(fn(payload, meta), { type })\n ) as FsaMapBuilder, Box, Box>;\n }\n\n return Object.assign(constructor, { map });\n}\n","import { StringType, Box, FsaMapBuilder, FsaBuilder } from './types';\nimport { createActionWithType } from './create-action-with-type';\nimport { validateActionType } from './utils';\n\nexport interface CreateAsyncAction<\n T1 extends StringType,\n T2 extends StringType,\n T3 extends StringType\n> {\n // tslint:disable-next-line:callable-types\n (): AsyncActionBuilder;\n // withMappers(\n // requestMapper: (a?: A1) => P1,\n // successMapper: (a?: A2) => P2,\n // failureMapper: (a?: A3) => P3\n // ): AsyncActionWithMappers;\n}\n\nexport type AsyncActionBuilder<\n T1 extends StringType,\n T2 extends StringType,\n T3 extends StringType,\n P1,\n P2,\n P3\n> = {\n request: FsaBuilder>;\n success: FsaBuilder>;\n failure: FsaBuilder>;\n};\n\nexport type AsyncActionWithMappers<\n T1 extends StringType,\n T2 extends StringType,\n T3 extends StringType,\n A1 = void,\n P1 = void,\n A2 = void,\n P2 = void,\n A3 = void,\n P3 = void\n> = {\n request: FsaMapBuilder, Box>;\n success: FsaMapBuilder, Box>;\n failure: FsaMapBuilder, Box>;\n};\n\n/** implementation */\nexport function createAsyncAction<\n T1 extends StringType,\n T2 extends StringType,\n T3 extends StringType\n>(\n requestType: T1,\n successType: T2,\n failureType: T3\n): CreateAsyncAction {\n [requestType, successType, failureType].forEach((arg, idx) => {\n validateActionType(arg, idx + 1);\n });\n\n function constructor(): AsyncActionBuilder<\n T1,\n T2,\n T3,\n P1,\n P2,\n P3\n > {\n return {\n request: createActionWithType(requestType, type => (payload?: P1) => ({\n type: requestType,\n payload,\n })) as FsaBuilder>,\n success: createActionWithType(successType, type => (payload?: P2) => ({\n type: successType,\n payload,\n })) as FsaBuilder>,\n failure: createActionWithType(failureType, type => (payload?: P3) => ({\n type: failureType,\n payload,\n })) as FsaBuilder>,\n };\n }\n\n // function withMappers(\n // requestMapper: (a?: A1) => P1,\n // successMapper: (a?: A2) => P2,\n // failureMapper: (a?: A3) => P3\n // ): AsyncActionWithMappers {\n // return {\n // request: createActionWithType(requestType, type => (payload?: A1) => ({\n // type,\n // payload: requestMapper != null ? requestMapper(payload) : undefined,\n // })) as MapBuilder, B>,\n // success: createActionWithType(successType, type => (payload?: A2) => ({\n // type,\n // payload: successMapper != null ? successMapper(payload) : undefined,\n // })) as MapBuilder, B>,\n // failure: createActionWithType(failureType, type => (payload?: A3) => ({\n // type,\n // payload: failureMapper != null ? failureMapper(payload) : undefined,\n // })) as MapBuilder, B>,\n // };\n // }\n\n return Object.assign(constructor, {});\n}\n","import { StringType, ActionCreator, TypeMeta } from './types';\n\n/**\n * @description get the \"type literal\" of a given action-creator\n */\nexport function getType(\n creator: ActionCreator & TypeMeta\n): T {\n if (creator == null) {\n throw new Error('first argument is missing');\n }\n\n if (creator.getType == null) {\n throw new Error('first argument is not an instance of \"typesafe-actions\"');\n }\n\n return creator.getType();\n}\n","import { StringType } from './types';\nimport { validateActionType } from './utils';\n/**\n * @description (curried assert function) check if action type is equal given type-constant\n * @description it works with discriminated union types\n */\nexport function isOfType(\n type: T,\n action: A\n): action is A extends { type: T } ? A : never;\n\n/**\n * @description (curried assert function) check if action type is equal given type-constant\n * @description it works with discriminated union types\n */\nexport function isOfType<\n T extends K[],\n K extends StringType,\n A extends { type: StringType }\n>(type: T, action: A): action is A extends { type: T } ? A : never;\n\n/**\n * @description (curried assert function) check if action type is equal given type-constant\n * @description it works with discriminated union types\n */\nexport function isOfType(\n type: T\n): (\n action: A\n) => action is A extends { type: T } ? A : never;\n\n/**\n * @description (curried assert function) check if action type is equal given type-constant\n * @description it works with discriminated union types\n */\nexport function isOfType(\n type: T\n): (\n action: A\n) => action is A extends { type: T } ? A : never;\n\n/** implementation */\nexport function isOfType<\n T extends StringType | StringType[],\n A extends { type: StringType }\n>(actionType: T, actionOrNil?: A) {\n Array.isArray(actionType)\n ? actionType.forEach(type => validateActionType(type))\n : validateActionType(actionType);\n\n const assertFn = Array.isArray(actionType)\n ? (action: A) => actionType.includes(action.type)\n : (action: A) => action.type === actionType;\n\n // with 1 arg return assertFn\n if (actionOrNil == null) {\n return assertFn;\n }\n // with 2 args invoke assertFn and return the result\n return assertFn(actionOrNil);\n}\n","import { TypeMeta } from './types';\n\nexport type AC = ((...args: any[]) => T) &\n TypeMeta;\n\n/**\n * @description (curried assert function) check if an action is the instance of given action-creator(s)\n * @description it works with discriminated union types\n * @inner If you need more than 5 arguments -> use switch\n */\nexport function isActionOf(\n actionCreators: [AC],\n action: { type: string }\n): action is [T1][number];\nexport function isActionOf<\n A extends { type: string },\n T1 extends A,\n T2 extends A\n>(\n actionCreators: [AC, AC],\n action: { type: string }\n): action is [T1, T2][number];\nexport function isActionOf<\n A extends { type: string },\n T1 extends A,\n T2 extends A,\n T3 extends A\n>(\n actionCreators: [AC, AC