Skip to content

Missing overload for createQuery with 'effect' + 'validate' #441

@js2me

Description

@js2me

I' ve add modified example from documentation about validators in my ts project and got ts errors
https://farfetched.pages.dev/tutorial/validators.html

const blockQuery = createQuery<string, Record<string, any>, any>({
  effect: createEffect<string, Record<string, any>, any>(async (id: string) => {
    const response = await fetch(`https://api.salo.com/blocks/${id}.json`);
    return response.json() as unknown as Record<string, any>;
  }),
  validate: ({ result, params }) => result.id === params,
});

image

If I will add more typings for validate property then problem is already exist

validate: ({
    result,
    params,
  }: {
    result: Record<string, any>;
    params: string;
  }) => result.id === params

image

P.S. this code works fine in runtime without typescript

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions