Reputation: 249
I've created an app with npx create-react-app my-app --typescript
and I would like to configure it so that my app will still compile despite typescript errors so that I can return to them when I'm ready.
I do not see any compilerOptions
for this. Is it possible?
Upvotes: 5
Views: 8340
Reputation: 249
{
"compilerOptions": {
...
strict: false
}
)
Admittedly a Typescript noob but this took me forever to figure out. CRA defaults strict to true which will fail the compilation for a wide range of errors. This is extremely implicit and it looks like setting this to true does quite a few other things as well:
enables --noImplicitAny, --noImplicitThis, --alwaysStrict, --strictBindCallApply, --strictNullChecks, --strictFunctionTypes and --strictPropertyInitialization.
There are other errors I'm still getting a failed compilation for ie:
Property 'property' does not exist on type 'unknown'.
I can get around it without much hassle and maybe I'm not using Typescript the way it is meant to be used but all I want is to see the warnings in my IDE so I can return to them when I'm ready after I at least have some proof of concept. Drove me a little crazy to the point where I was considering restarting without TS even though I really like it and have benefited from using it.
I think there should be something on the tsconfig docs with at least a brief summary of the implications from this strict
option, but I digress.
Upvotes: 10