If you have a function with a signature like (action: any) => action is FooAction in your type field, action should be FooAction in the hooks.
Proof of concept:
interface FooAction {
type: "FOO";
payload: {
foo: number;
}
}
type TypeGuard<A> = (action: any) => action is A;
declare const isFoo: TypeGuard<FooAction>;
interface LogicConfig<A> {
type: TypeGuard<A>;
process: (data: { action: A }) => void;
}
declare function createLogic<A>(cfg: LogicConfig<A>): void;
createLogic({
type: isFoo,
process({ action }) {
action.payload.foo.toFixed(); // no error
action.payload.bar; // error
}
});
Unfortunately I'm not too familiar with this project's definitions to make a PR in the near future.