Middleware that validates actions against a schema before they reach the reducer. Invalid actions are silently dropped (with a console warning).
Internal actions are never validated — they always pass through.
const validator = actionValidator<GameState, GameAction>({ SCORE: (action) => action.payload > 0,}); Copy
const validator = actionValidator<GameState, GameAction>({ SCORE: (action) => action.payload > 0,});
Middleware that validates actions against a schema before they reach the reducer. Invalid actions are silently dropped (with a console warning).
Internal actions are never validated — they always pass through.