Type Error after update from next 13.0.3 to 13.0.5 with NextApiResponse
See original GitHub issueIn the latest version of next (13.0.5) they removed the unstable_revalidate
function from the NextApiResponse
interface.
I became so now a compile error if I use the preview mode of next-drupal, because it has next in version 12 as dependency.
The following code create this error, I think that drupal.preview
check this type with the dependency.
import { drupal } from 'lib/drupal';
import type { NextApiRequest, NextApiResponse } from 'next';
export default async function handler(
request: NextApiRequest,
response: NextApiResponse
) {
return drupal.preview(request, response);
}
Argument of type 'import("node_modules/next/dist/shared/lib/utils").NextApiResponse<any>' is not assignable to parameter of type 'import("node_modules/next-drupal/node_modules/next/dist/shared/lib/utils").NextApiResponse<any>'.
Property 'unstable_revalidate' is missing in type 'ServerResponse<IncomingMessage> & { send: Send<any>; json: Send<any>; status: (statusCode: number) => NextApiResponse<any>; redirect(url: string): NextApiResponse<...>; redirect(status: number, url: string): NextApiResponse<...>; setPreviewData: (data: string | object, options?: { ...; }) => NextApiResponse<...>; cl...' but required in type '{ send: Send<any>; json: Send<any>; status: (statusCode: number) => NextApiResponse<any>; redirect(url: string): NextApiResponse<any>; redirect(status: number, url: string): NextApiResponse<...>; setPreviewData: (data: string | object, options?: { ...; }) => NextApiResponse<...>; clearPreviewData: (options?: { ...; ...'.ts(2345)
utils.d.ts(225, 5): 'unstable_revalidate' is declared here.
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Support Next.js 13 `app` directory · Issue #5647 - GitHub
The only thing left is to get the request/response object to get the session on the layout server component and pass it to...
Read more >Upgrade Guide - Next.js
Upgrade Guide. Upgrading from 12 to 13. To update to Next.js version 13, run the following command using your preferred package manager:
Read more >Handling API errors in Next.js - By Giancarlo Buomprisco
Learn how to write a Next.js middleware pipe to automatically and elegantly handle exceptions in your API functions.
Read more >resolver is not a function nextjs - You.com | The AI Search ...
I am attempting to create a basic post on click in my NextJS app to a MongoDB database. The issue i am getting...
Read more >next@10.0.5 - Snyk Vulnerability Database
Learn more about known next 10.0.5 vulnerabilities and licenses detected. ... Specially encoded paths could be used when pages/_error.js was statically ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m working on adding support for Next.js 13 this week. I’ll update here when done. Thank you.
@martdavidson Thanks for your helping testing this. I’ve merged the PR. This will be in the
1.6.0
release.