Next.js: Next.js from v9.3 to latest ignoring typescript errors

Created on 7 Jun 2020  路  6Comments  路  Source: vercel/next.js

Bug report

Ignoring Typescript errors and getting compiled successfully with errors

Describe the bug

// Next.js API route support: https://nextjs.org/docs/api-routes/introduction

import { NextApiRequest, NextApiResponse } from 'next'

const handler = (req: NextApiRequest, res: NextApiResponse) => {
res.go = 200
res.json({ name: 'John Doe' })
}

export default handler
Vs code shows res.go as an error because it's an error but next.js v 9.4.4 is compiling it successfully 9.2 is fine and throwing errors in my project

please add a complete reproduction

Most helpful comment

I don't foresee why having compile-time errors while running dev isn't a good feature, Cause I personally find that feature in create-react-app really good

All 6 comments

Could you please share a full project? Including your tsconfig.json?

It's one of your examples itself actually while doing npx create-next-app I selected with-typescript and deliberately entered wrong Types for res as mentioned above and it compiled successfully while the same doesn't get compiled with create-react-app typescript template and also next 9.2 sometimes compile it successfully and sometimes shows typescript errors

TypeScript errors are not shown during development time (next dev) and during production build (next build).

It is getting shown for V 9.2 at least while running next dev

Yes, the behavior changed in 9.4 for the Fast Refresh experience!

I don't foresee why having compile-time errors while running dev isn't a good feature, Cause I personally find that feature in create-react-app really good

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kenji4569 picture kenji4569  路  3Comments

swrdfish picture swrdfish  路  3Comments

sospedra picture sospedra  路  3Comments

DvirSh picture DvirSh  路  3Comments

knipferrc picture knipferrc  路  3Comments