I am getting the error "TS2304: Cannot find name 'AppProps' when I attempt to start a simple Next Js Typescript project. I have read through several other occurrences of this error on Stack Overflow, and I do not think I have similar issues.
import type { AppProps } from 'next/app'; function MyApp({ Component, pageProps }: AppProps) { return ( <Component {...pageProps} /> ); } export default MyApp;
How can I fix this error?
You can try to update TypeScript and Next.js to the latest versions, and reinstall dependencies. import type
works on the fresh Next.js install, with the recent TypeScript versions.
import type { AppProps } from 'next/app';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.