Checks an action's type and narrows its payload and metadata types.
Payload type of the action creator.
Metadata type of the action creator.
Action creator whose type to match.
Action to check.
true when the action type matches the creator.
true
import { createAction, isType } from '@pacote/flux-actions'const changeYear = createAction<number>('CHANGE_YEAR')const action = changeYear(1955)if (isType(changeYear, action)) { action.payload // number} Copy
import { createAction, isType } from '@pacote/flux-actions'const changeYear = createAction<number>('CHANGE_YEAR')const action = changeYear(1955)if (isType(changeYear, action)) { action.payload // number}
Checks an action's type and narrows its payload and metadata types.