Bug: strict mode does not show any error when nx serve
bdebon opened this issue · comments
Expected behavior:
When strict mode enabled, the compilation should yell something it there is a strict error.
Current behavior:
Compilation during nx serve
does not say anything. It does say something when you build with nx build
.
I have no clue why it behaves like this, it's the first time I have such a thing in a Nx project. I could find any quick answer to that...
Strict mode is only related to Typescript, hence erroring with type issues. And when using Typescript, static type-checking only happens once you build/compile your project (no runtime type-checking mainly because it wasn't designed to do so).
With Next.js, it is the same behavior. When you start your app (next start
or in the case of choiceof.dev, nx serve
), it only starts the app but doesn't compile it. In fact, when starting your Next.js app, all types are removed so Typescript has no idea if something. Runtime errors would only be syntax errors, or React errors. It is only at build-time (next build
) that Next.js has a step for type-checking.
I think this is an issue for you since you went from strict:false
to strict:true
, so new type errors can be anywhere in the existing project. But now since you've fixed the project, ESLint and TSServer in your IDE will do a sufficient job of showing errors but only when you open the file.