graphql-http icon indicating copy to clipboard operation
graphql-http copied to clipboard

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

Open osama-mhmd opened this issue 10 months ago • 0 comments

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 :)

osama-mhmd avatar Feb 03 '25 19:02 osama-mhmd