Skip to content

Instantly share code, notes, and snippets.

@brian-mcallister-lab49
Last active May 14, 2020 13:47
Show Gist options
  • Save brian-mcallister-lab49/06bf283a7ebb52695d47034ae86f6ebd to your computer and use it in GitHub Desktop.
Save brian-mcallister-lab49/06bf283a7ebb52695d47034ae86f6ebd to your computer and use it in GitHub Desktop.
TIL-Lab49/TypeScript strict mode has more fine grained control than just --strict.

There's more options than just --strict, you can control it in a more fine grained way. This could be useful if you have a project that started without strict mode, but you want to turn it on. Here's the available options from the documentation:

Option Type and Default Description
--strict boolean false Enable all strict type checking options. Enabling --strict enables --noImplicitAny, --noImplicitThis, --alwaysStrict, --strictBindCallApply, --strictNullChecks, --strictFunctionTypes and --strictPropertyInitialization.
--strictBindCallApply boolean false Enable stricter checking of the bind, call, and apply methods on functions.
--strictFunctionTypes boolean false Disable bivariant parameter checking for function types.
--strictPropertyInitialization boolean false Ensure non-undefined class properties are initialized in the constructor. This option requires --strictNullChecks be enabled in order to take effect.
--strictNullChecks boolean false In strict null checking mode, the null and undefined values are not in the domain of every type and are only assignable to themselves and any (the one exception being that undefined is also assignable to void).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment