What is @tsconfig/strictest?
@tsconfig/strictest is a TypeScript configuration package that provides the strictest possible settings for TypeScript projects. It is designed to enforce the highest level of type safety and code quality by enabling all strict type-checking options available in TypeScript.
What are @tsconfig/strictest's main functionalities?
Strict Type-Checking
Enables all strict type-checking options in TypeScript, ensuring that the code adheres to the highest standards of type safety.
{"compilerOptions":{"strict":true,"noImplicitAny":true,"strictNullChecks":true,"strictFunctionTypes":true,"strictBindCallApply":true,"strictPropertyInitialization":true,"noImplicitThis":true,"alwaysStrict":true}}
No Implicit Returns
Ensures that all functions have explicit return statements, preventing accidental undefined returns.
{"compilerOptions":{"noImplicitReturns":true}}
No Fallthrough Cases in Switch
Prevents fallthrough cases in switch statements, which can lead to unexpected behavior.
{"compilerOptions":{"noFallthroughCasesInSwitch":true}}
No Unused Locals and Parameters
Flags any unused local variables and parameters, helping to keep the codebase clean and maintainable.
{"compilerOptions":{"noUnusedLocals":true,"noUnusedParameters":true}}
Other packages similar to @tsconfig/strictest
tsconfig-strictest
tsconfig-strictest is another package that aims to provide the strictest TypeScript configuration. It is similar to @tsconfig/strictest but may have slight differences in the specific compiler options enabled.
A base TSConfig for working with Strictest.
Add the package to your "devDependencies"
:
npm install --save-dev @tsconfig/strictest
yarn add --dev @tsconfig/strictest
Add to your tsconfig.json
:
"extends": "@tsconfig/strictest/tsconfig.json"
The tsconfig.json
:
{
"compilerOptions": {
"strict": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"isolatedModules": true,
"checkJs": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"$schema": "https://json.schemastore.org/tsconfig",
"_version": "2.0.0"
}
You can find the code here.