Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
osama-mhmd opened this issue Feb 3, 2025 · 0 comments
Open

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

osama-mhmd opened this issue Feb 3, 2025 · 0 comments

Comments

@osama-mhmd
Copy link

osama-mhmd commented Feb 3, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant