DEV Community

Cover image for How strict is Typescript's strict mode?

How strict is Typescript's strict mode?

briwa on June 01, 2019

I started out writing code in Javascript without proper typing. When I switched to Typescript, I migrated my code without turning the strict mode o...
Collapse
 
stereobooster profile image
stereobooster

FYI: tslint will be deprecated in favour of eslint.

Collapse
 
ezzabuzaid profile image
ezzabuzaid

I think that this rules for typescript compiler and not tslint

Collapse
 
stereobooster profile image
stereobooster

If you want to take Typescript restrictions to a different level, I recommend using tslint, though I would say some of the rules are based on preferences, but there are a lot of useful ones

Thread Thread
 
ezzabuzaid profile image
ezzabuzaid • Edited

Definitely it does.

Collapse
 
briwa profile image
briwa

Whoa, TIL! Thanks for the info.

Collapse
 
ezzabuzaid profile image
ezzabuzaid

Good article!

In most cases, I don't think that you'll encounter "strictFunctionTypes" because of the other rules and I guess that you can set all of them once using the "strict" property

Collapse
 
goran7777 profile image
Goran

I am newbie in react typescript and my linter and compiler always complain about something,should i turn of "strict" mode.

Collapse
 
briwa profile image
briwa

Hello, I would advise not to turn it off but instead understand why it's giving you such error; it's going to slow you down but you'd have a better understanding about strict type checking in Typescript, and before you know it you'd be accustomed with the rules and there will be no more errors moving forward.

However on the contrary, if the errors are too overwhelming for you, sure you can simply turn off the strict mode, and maybe learn about the rules outside of the project instead. Or even further, use Javascript. Hope that helps.