export interface ReduxAction
{ payload: P type: string } export type ActionCreator
= ((payload: P) => ReduxAction
) & { type: string match: (action: { type: string }) => action is ReduxAction
} // Same low-level shape @rific/core's createSettingsSlice gives every other slice in the fleet // (namespaced type string, .type, .match). Shared internally between profilesSlice.ts and // profileExtensionSlice.ts rather than each hand-rolling its own copy - not exported from // index.ts, since it's an implementation detail of how this package's own reducers are built, not // something a consuming app needs. export function createActionCreator
(type: string): ActionCreator
{ const creator = ((payload: P) => ({ payload, type })) as ActionCreator
creator.type = type creator.match = (action: { type: string }): action is ReduxAction
=> action.type === type return creator }