typescript/Settings for strong typing

This is what I consider the best set of TypeScript settings for strong typing. It includes strict type checking and various other options to ensure that your code is robust and maintainable.

{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.base.json",
"compilerOptions": {
// Options for strong typing:
"strict": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
// Options to improve code quality and maintainability:
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false
}
}

Strong vs Weak Typing

In programming, strong typing and weak typing refer to how strictly a language enforces data type rules.

Strong type systems rigidly enforces type rules, working hard on preventing operations between incompatible types.

Weak typing on the other hand, allows for more flexibility and implicit type conversions, which can lead to runtime errors if not handled carefully.

For more information on these options, see the TypeScript documentation or the individual options below: