Skip to content

Typescript error when using graphql-http/lib/use/express #142

Open
@osama-mhmd

Description

@osama-mhmd

Writing any of these methods will through a TypeError of Argument of type 'Request<{}, any, any, ParsedQs, Record<string, any>>' is not assignable to parameter of type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'. Property 'param' is missing in type 'Request<{}, any, any, ParsedQs, Record<string, any>>' but required in type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.

app.all("/graphql", createHandler({ schema }));
app.all("/graphql", (req, res, next) =>  
  createHandler({ schema, context: (req) => ({ req, res }) })(
    req,
    res,
    next
  )
);

However the same code in JavaScript runs without any errors.

Update: After searching, I found that maybe [email protected] has conflicts with the current API. graphql-http is using [email protected] which is old, I will fix this :)

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