5

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?

1 Answer 1

10
{
  "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.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 the suggestion to update their documentation. Incidentally, the Typescript docs are open-source, so you could make a pull request to that effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.