Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary <!-- Succinctly describe your change, providing context, what you've changed, and why. --> Ensures we support Next.js by being looser with second argument typing for `GET`, `POST`, and `PUT` endpoints. ``` $ pnpm build > [email protected] build /home/nixos/scratch/inngest-nextjs15-bug > next build ⚠ Configuration with next.config.ts is currently an experimental feature, use with caution. ▲ Next.js 15.0.0-canary.177 Creating an optimized production build ... ✓ Compiled successfully Linting and checking validity of types ...Failed to compile. src/app/api/inngest/route.ts Type error: Route "src/app/api/inngest/route.ts" has an invalid "GET" export: Type "ServerResponse<IncomingMessage> & { send: Send<any>; json: Send<any>; ... 5 more ...; revalidate: (urlPath: string, opts?: { ...; } | undefined) => Promise<...>; }" is not a valid type for the function's second argument. ``` This is due to Next.js majors (and execution environments) all requiring different typing for that second argument, from `undefined`, to `NextApiResponse`, to `RouteContext`, which is _enforced_ by build-step type checking. Instead we set `unknown` and handle the difference manually at runtime. ## Checklist <!-- Tick these items off as you progress. --> <!-- If an item isn't applicable, ideally please strikeout the item by wrapping it in "~~"" and suffix it with "N/A My reason for skipping this." --> <!-- e.g. "- [ ] ~~Added tests~~ N/A Only touches docs" --> - [ ] ~Added a [docs PR](https://github.com/inngest/website) that references this PR~ N/A Bug fix - [x] Added unit/integration tests - [x] Added changesets if applicable ## Related <!-- A space for any related links, issues, or PRs. --> <!-- Linear issues are autolinked. --> <!-- e.g. - INN-123 --> <!-- GitHub issues/PRs can be linked using shorthand. --> <!-- e.g. "- inngest/inngest#123" --> <!-- Feel free to remove this section if there are no applicable related links.--> - Fixes #717
- Loading branch information