fix(pages): avoid types errors

This commit is contained in:
Walid 2022-03-24 01:44:55 +01:00
parent d46be16a11
commit 6beb23cf58
No known key found for this signature in database
GPG Key ID: 4BDA1ABD227F9279
2 changed files with 5 additions and 6 deletions

View File

@ -2,7 +2,7 @@ import type { AppProps } from 'next/app'
import '../styles/main.scss' import '../styles/main.scss'
const MyApp = ({ Component, pageProps }: AppProps) => { const MyApp = ({ Component, pageProps }: AppProps): JSX.Element => {
return <Component {...pageProps} /> return <Component {...pageProps} />
} }

View File

@ -1,13 +1,12 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next' import type { NextApiRequest, NextApiResponse } from 'next'
type Data = { interface Data {
name: string name: string
} }
export default function handler( const handler = (req: NextApiRequest, res: NextApiResponse<Data>): void => {
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: 'John Doe' }) res.status(200).json({ name: 'John Doe' })
} }
export default handler