Skip to content

createEffect doesn't resolve void Params #106

Description

@today-

Issuehunt badges

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 goodmind has been rewarded.

Backers (Total: $40.00)

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

Metadata

Metadata

Assignees

No one assigned

    Labels

    🎁 Rewarded on IssuehuntThis issue has been rewarded on IssuehunttypingsTypescript public type definitions issues

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions