// Copyright (C) 2020 Intel Corporation // // SPDX-License-Identifier: MIT import { Action, ActionCreatorsMapObject, AnyAction } from 'redux'; import { ThunkAction as _ThunkAction, ThunkDispatch as _ThunkDispatch } from 'redux-thunk'; import { CombinedState } from '../reducers/interfaces'; export interface ActionWithPayload extends Action { payload: P; } export function createAction(type: T): Action; export function createAction(type: T, payload: P): ActionWithPayload; export function createAction( type: T, payload?: P, ): Action | ActionWithPayload { return typeof payload === 'undefined' ? { type } : { type, payload }; } export type ActionUnion = ReturnType; export type ThunkAction = _ThunkAction; export type ThunkDispatch = _ThunkDispatch;