-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to strictNullChecks: true for new projects #1934
Comments
Isn't I like the strict mode tho. And at work we had the exact same problem of yours. |
I think you may have misunderstood. The default does currently use |
@dmint789, starting with ES2022, the |
But that's not the only thing it checks. The most important thing is that it'll show an error when you do |
I didn't get this one. Using
|
@dmint789, My apologies, I confused |
Oh, looks like I was mistaken. Then the thing that should be changed is that Nest JS comes with strict mode by default and includes a non-strict flag instead. There's no way that the standard way to use Typescript should be to allow devs to ignore types. |
Although I like the strict mode, I don't think that we will make But let's see if Kamil changed his mind on this |
I just read that, but I still think the downside of inexperienced devs missing this and way down the line having to migrate a huge codebase to strict mode is a lot higher than the issue of people who are already migrating from JS having to do extra checks. The current solution is like the worst of both worlds: JS devs still have to go through the pain of migrating to TS, and TS devs who started with Nest JS + TS to begin with still have to migrate to strict mode when they realize that it's a better experience. @kamilmysliwiec please consider if strict mode can be made the default with an optional --non-strict mode. |
I think these flags are singular in the way that people will either really need/want them or really don't want them, there is no in-between. I agree that defaulting to full strict mode is intrusive/overkill for the latter, although the former could benefit from making an informed choice during cli init, since flags like |
But then we're prioritizing people migrating to Nest JS over new users. Why not make the setup aimed at new users (starting with Nest JS for their projects to begin with) by default? If people migrating want to change the settings, they can. Type safety should be opt-out, not opt-in. |
I don't know. I still feel that the only flags that should be turned on by default are: |
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
I have realized that Nest JS sets up projects with
strictNullChecks: false
in thetsconfig.json
by default. I was a bit of a beginner in web development when I first started using Nest JS, but I now see that this is not a good setting to use, because it leads to many bugs being missed. Now I have to migrate quite a big code base tostrictNullChecks: true
, which will cost me a lot of time.Describe the solution you'd like
This option should not be set in new Nest JS projects (meaning Typescript will treat it as true, since Nest JS sets
strict: true
for new projects).Teachability, documentation, adoption, migration strategy
This doesn't require developers having to relearn anything, because it would only apply to new Nest JS projects.
What is the motivation / use case for changing the behavior?
This will prevent developers from having to migrate their code bases if they decided to change this setting in the future. If they wanted to set it to false, they could do so without having to change anything in the code, because that would be more permissive.
The text was updated successfully, but these errors were encountered: