
I have this code:
const handler = () => console.log();
const effect = createEffect('', {handler});
effect();
I got TS2554: Expected 1 arguments, but got 0. An argument for payload was not provided
So, I have to manually declare effect typings like this:
const effect = createEffect<void, void, any>('', {handler});
Or write wrappers:
const createBetterEffect = <Params = void, Done = any>(
name?: string,
options?: {handler?: (() => Done | Promise<Done>) | ((p: Params) => Done | Promise<Done>)},
) =>
createEffect<Params, Done, string>(name, options);
I want createEffect to correctly infer void type of Params
IssueHunt Summary
goodmind has been rewarded.
Backers (Total: $40.00)
Submitted pull Requests
Tips
IssueHunt has been backed by the following sponsors. Become a sponsor
I have this code:
I got
TS2554: Expected 1 arguments, but got 0. An argument for payload was not providedSo, I have to manually declare effect typings like this:
Or write wrappers:
I want
createEffectto correctly infervoidtype of ParamsIssueHunt Summary
Backers (Total: $40.00)
Submitted pull Requests
Tips
IssueHunt has been backed by the following sponsors. Become a sponsor