Allow --type-check
to be set to false
and override nest-cli.json
#2796
Labels
--type-check
to be set to false
and override nest-cli.json
#2796
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
Right now it does seem possible to turn off type-checking with SWC if it is enabled in the nest-cli.json.
Take this config:
Running
nest start
starts the TSC TypeChecker and when done builds withswc
which is what I expect. If i now usenest build --type-check=false
(also tried without=
) the type check will start anyway. This seems to be a somewhat specific handling for this flag only, asnest start --builder=tsc
would start the build process usingtsc
instead, ruling over my nest-cli.json.Describe the solution you'd like
The easiest solution would be to allow
--type-check
(and maybe other boolean-like flags) to also be disabled by the CLI via an (optional) argument. I've tried finding my way through this repository but couldn't quite figure out where this logic happens.Teachability, documentation, adoption, migration strategy
User could add an additional, optional parameter after the
--type-check
. I'd suggest an interface like this:as this would not touch the current behavior there shouldn't be any issues with just releasing this as an minor issue.
What is the motivation / use case for changing the behavior?
I have two motivations for this change, which boil down to the same reason: speed and efficiency.
The first use case is in our CI: We're already type-checking our whole monorepo earlier in the CI process so it's not necessary to do this again when building NestJS. Removing the unnecessary type check here will speed up the process by about 20s.
Our second use case is swagger.json generation. If our Nest Application is started with a specific environment variable it will only output the swagger.json and then exit. This is needed to generate the OpenAPI Clients based on this swagger file. At this time in the process we don't really care if the types are valid (cause either it is mid-development or they've already been checked before in the CI) so we would love to also skip type checking there as well.
The text was updated successfully, but these errors were encountered: