8000 Typescript error rest client custom method · Issue #2775 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

Typescript error rest client custom method #2775

@AshotN

Description

@AshotN

Steps to reproduce

const restClient = rest("http://localhost:3030").fetch(
  window.fetch.bind(window)
);
const client = createClient(restClient);

client.use("user", restClient.service("user"), {
  methods: ["get", "create", "patch", "aCustomMethod"],
});

image

Actual behavior

TS2345: Argument of type 'Partial<ServiceMethods<any, Partial<any>, Params<Query>>>' is not assignable to parameter of type 'ClientService<{ first_name?: string | undefined; last_name?: string | undefined; role?: string | undefined; email?: string | undefined; password?: string | undefined; id: string; }, { id?: string | undefined; ... 4 more ...; password: string; }, { ...; }, Paginated<...>, Params<...>> & { ...; }'.   Type 'Partial<ServiceMethods<any, Partial<any>, Params<Query>>>' is not assignable to type 'ClientService<{ first_name?: string | undefined; last_name?: string | undefined; role?: string | undefined; email?: string | undefined; password?: string | undefined; id: string; }, { id?: string | undefined; ... 4 more ...; password: string; }, { ...; }, Paginated<...>, Params<...>>'.     Types of property 'find' are incompatible.       Type '((params?: Params<Query> | undefined) => Promise<any>) | undefined' is not assignable to type '(params?: Params<{ id?: string | { $gt?: string | undefined; $gte?: string | undefined; $lt?: string | undefined; $lte?: string | undefined; $ne?: string | undefined; $in?: string[] | undefined; $nin?: string[] | undefined; } | undefined; ... 7 more ...; $select?: DeepWritable<...>[] | undefined; }> | undefined) => ...'.         Type 'undefined' is not assignable to type '(params?: Params<{ id?: string | { $gt?: string | undefined; $gte?: string | undefined; $lt?: string | undefined; $lte?: string | undefined; $ne?: string | undefined; $in?: string[] | undefined; $nin?: string[] | undefined; } | undefined; ... 7 more ...; $select?: DeepWritable<...>[] | undefined; }> | undefined) => ...'.

System configuration

Tell us about the applicable parts of your setup.

Module versions :

"@feathersjs/authentication-client": "^5.0.0-pre.29",
"@feathersjs/feathers": "^5.0.0-pre.29",
"@feathersjs/rest-client": "^5.0.0-pre.29",
"typescript": "^4.8.4"

Everything else works, besides the Typescript error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0