Could you reconsider the "tsconfig.json" default value of "strict: false"?
See original GitHub issueFeature request
I just noticed that next.js defaults to strict: false
in the generated tsconfig.json
.
The reasoning behind seems to be (quoting @Timer from ##7716):
Users who are testing out Next.js’ TypeScript support shouldn’t be stuck behind a failure to compile screen. This will allow advanced users to opt into strict: true when they’re ready.
I would ask you if it were possible to reconsider this.
Running tsc --init
creates a tsconfig.json
with strict: true
since that option was introduced with TypeScript 2.3.
An advanced user will probably not notice this for quite some time, because they assume that TypeScript offers it’s full (default-configuration) functionality out of the box, just wondering about unsound behaviour here and there until it piles up and finally going to strict: true
has actually become a chore.
If there are any strict options that are not working well with next.js, it’s still an option, to default to strict: true
in combination with strictThatHurts: false
and mentioning to that in the documentation.
I have to admit that I’m not even a next.js user myself (athough it is in my list of stuff to check out!), but got a report by a user of our library (@reduxjs/toolkit) about strange behaviour - which we could attribute back to strictNullChecks
being disabled. The user was quite irritated because they had assumed that strict
would be enabled.
So I don’t really believe that you’re doing your users a service with this default 😦
As an alternative, if you could not commit to a strict: true
default, maybe it might be an option to actively ask the user for feedback on it when the tsconfig.json
would be filled with the default values - and let the user decide between “loose” and “strict” behaviour?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:6 (3 by maintainers)
Top GitHub Comments
User assumption is not the responsibility of the framework, I supposed. Note typescript is not perfect, the trans-piled code sometimes can cause unexpected behavior, too.
I think the default should stay as false. User can change to true anytime as they see fit. Or better, checkout https://github.com/facebook/prop-types
hey team, love the work. since a flag
--typescript / -ts
was added for thenext-app
cli, is there any chance this config should be changed to match that one? (that currently enforcesstrict
by default)?