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

Type error: does not satisfy the constraint 'ParamCheck<RouteContext>' #229

Open
dincerpece opened this issue Nov 14, 2024 · 2 comments · May be fixed by #230
Open

Type error: does not satisfy the constraint 'ParamCheck<RouteContext>' #229

dincerpece opened this issue Nov 14, 2024 · 2 comments · May be fixed by #230

Comments

@dincerpece
Copy link

Link to the issue created by nextjs:

vercel/next.js#72525

@martinnabhan martinnabhan linked a pull request Nov 15, 2024 that will close this issue
@mrjackyliang
Copy link

Hmm, I'm lost. Any workarounds for this or a way to help me understand the problem?

> next build

   ▲ Next.js 15.1.4
   - Environments: .env

   Creating an optimized production build ...
 ✓ Compiled successfully
   Linting and checking validity of types  ...Failed to compile.

src/app/api/graphql/route.ts
Type error: Route "src/app/api/graphql/route.ts" has an invalid "GET" export:
  Type "undefined" is not a valid type for the function's second argument.
    Expected "RouteContext", got "undefined".

Static worker exited with code: 1 and signal: null
ERROR: "prod:build" exited with 1.

Process finished with exit code 1

@martinnabhan
Copy link
Collaborator

For now, if you change

export { handler as GET, handler as POST }

to

export async function GET(request: NextRequest) {
  return handler(request);
}

export async function POST(request: NextRequest) {
  return handler(request);
}

the error goes away.

I'm working on implementing the correct type with #230.

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

Successfully merging a pull request may close this issue.

3 participants