Unverified Commit 9e59a6b5 authored by Michael McQuade's avatar Michael McQuade Committed by GitHub

Add type keyword to API Routes examples (#18234)

The other examples are using the typescript `import type` style, which gets stripped during the build, so I added it to the API Routes example too. 
parent 50a416a5
......@@ -74,7 +74,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
The following is an example of how to use the built-in types for API routes:
```ts
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'
export default (req: NextApiRequest, res: NextApiResponse) => {
res.status(200).json({ name: 'John Doe' })
......@@ -84,7 +84,7 @@ export default (req: NextApiRequest, res: NextApiResponse) => {
You can also type the response data:
```ts
import { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next'
type Data = {
name: string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment