Skip to content

Commit

Permalink
Fix type declaration for API Routes response (#31486)
Browse files Browse the repository at this point in the history
There is missing equals sign in the type declaration in the example for API Routes.

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
  • Loading branch information
knezevicdev and ijjk committed Nov 16, 2021
1 parent bf97316 commit af82de4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/api-routes/response-helpers.md
Expand Up @@ -85,11 +85,14 @@ You can make your response handlers more type-safe by importing the `NextApiRequ
```ts
import type { NextApiRequest, NextApiResponse } from 'next'

type ResponseData {
type ResponseData = {
message: string
}

export default function handler(req: NextApiRequest, res: NextApiResponse<ResponseData>) {
export default function handler(
req: NextApiRequest,
res: NextApiResponse<ResponseData>
) {
res.status(200).json({ message: 'Hello from Next.js!' })
}
```
Expand Down

0 comments on commit af82de4

Please sign in to comment.