Skip to content

Instantly share code, notes, and snippets.

@mattpocock
Created May 14, 2025 15:24
Show Gist options
  • Save mattpocock/51573beaeb5a83b6380f70075ac9ca0e to your computer and use it in GitHub Desktop.
Save mattpocock/51573beaeb5a83b6380f70075ac9ca0e to your computer and use it in GitHub Desktop.

Setting strict to false makes TypeScript behave in ways which are much less safe.

As an example, strict includes a setting called strictNullChecks. Setting strictNullChecks to false will allow you to assign null to a variable that is supposed to be a string:

let name: string = null; // No error

With strict enabled, TypeScript will, of course, catch this error.

Another example of a strict setting is noImplicitAny. Setting noImplicitAny to false will allow you to leave function parameters un-annotated:

function greet(name) {
  console.log(`Hello, ${name}!`);
}

This can lead to a flood of any types in your codebase - which as we know, leads to a loss of type safety.

In fact, I’ve written this entire book on the premise that you have strict enabled in your codebase. It’s the baseline for all modern TypeScript apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment