Issue
Here's the default _app.tsx from NextJS:
function MyApp({ Component, pageProps }) {
return (
<Component {...pageProps} />
)
}
The problem is, as soon as you switch to TypeScript, you get a warning under ES6Lint that these types are intrinsicly set to type 'any'. That being said, I can't figure out what type to set these two to that wont cause more errors later of mismatched types. What TypeScript types should I cast these two as?
Solution
You could import the types from nextjs
.
import { AppProps } from 'next/app';
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
Answered By - kind user
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.