import { ActionCreator, ActionCreatorProps, Creator, FunctionWithParametersType, NotAllowedCheck, Action } from './models'; type Join = Str extends `${infer First}${Separator}${infer Rest}` ? Join<`${First}${Rest}`, Separator> : Str; type CapitalizeWords = Str extends `${infer First} ${infer Rest}` ? `${Capitalize} ${CapitalizeWords}` : Capitalize; type StringLiteralCheck = string extends Str ? `${Name} must be a string literal type` : unknown; type UniqueEventNameCheck = ActionName extends ActionName> ? `${ActionName} action is already defined` : unknown; type NotAllowedEventPropsCheck | Creator> = PropsCreator extends ActionCreatorProps ? Props extends void ? unknown : NotAllowedCheck : PropsCreator extends Creator ? NotAllowedCheck : unknown; type EventCreator | Creator, Type extends string> = PropsCreator extends ActionCreatorProps ? void extends Props ? ActionCreator Action> : ActionCreator) => Props & Action> : PropsCreator extends Creator ? FunctionWithParametersType & Action> & Action : never; type ActionName = Uncapitalize>>; interface ActionGroupConfig | Creator>> { source: Source & StringLiteralCheck; events: Events & { [EventName in keyof Events]: StringLiteralCheck & UniqueEventNameCheck & NotAllowedEventPropsCheck; }; } type ActionGroup | Creator>> = { [EventName in keyof Events as ActionName]: EventCreator; }; /** * @description * A function that creates a group of action creators with the same source. * * @param config An object that contains a source and dictionary of events. * An event is a key-value pair of an event name and event props. * @returns A dictionary of action creators. * The name of each action creator is created by camel casing the event name. * The type of each action is created using the "[Source] Event Name" pattern. * * @usageNotes * * ```ts * const authApiActions = createActionGroup({ * source: 'Auth API', * events: { * // defining events with payload using the `props` function * 'Login Success': props<{ userId: number; token: string }>(), * 'Login Failure': props<{ error: string }>(), * * // defining an event without payload using the `emptyProps` function * 'Logout Success': emptyProps(), * * // defining an event with payload using the props factory * 'Logout Failure': (error: Error) => ({ error }), * }, * }); * * // action type: "[Auth API] Login Success" * authApiActions.loginSuccess({ userId: 10, token: 'ngrx' }); * * // action type: "[Auth API] Login Failure" * authApiActions.loginFailure({ error: 'Login Failure!' }); * * // action type: "[Auth API] Logout Success" * authApiActions.logoutSuccess(); * * // action type: "[Auth API] Logout Failure"; * authApiActions.logoutFailure(new Error('Logout Failure!')); * ``` */ export declare function createActionGroup | Creator>>(config: ActionGroupConfig): ActionGroup; export declare function emptyProps(): ActionCreatorProps; export {};