DX - Strict
Layer strict TypeScript checks on top of the essentials baseline so type errors, unused code, and unsafe patterns are caught at compile time.
Why Use This Preset?
- Turns on
strictand every individual strict flag so the compiler enforces null safety, typedthis, and sound function types. - Flags unused locals, parameters, unreachable code, and unused labels so dead code never ships.
- Enforces
exactOptionalPropertyTypesandnoUncheckedIndexedAccessso optional and indexed values are handled explicitly. - Sets
isolatedModulesandnoEmitOnErrorso files stay safe to transpile per-file and a failed check never emits output. - Overrides the baseline
skipLibChecktofalseso your dependencies' type declarations are checked too.
Usage
This preset is an overlay and must come after DX - Essentials in the extends chain, then before any environment layer.
{
"extends": [
"@cbnventures/nova/presets/tsconfig/dx-essentials.json",
"@cbnventures/nova/presets/tsconfig/dx-strict.json",
"@cbnventures/nova/presets/tsconfig/runtime-node.json"
]
}
warning
Using dx-strict on its own yields an incomplete config. It is an overlay that depends on dx-essentials being extended first.
What This Preset Configures
The preset sets the following compilerOptions on top of the essentials baseline.
| Setting | Value | Description |
|---|---|---|
allowArbitraryExtensions | false | Blocks importing files with non-standard extensions as modules. |
allowSyntheticDefaultImports | true | Keeps default imports from no-default modules working under skipLibCheck: false. |
allowUnreachableCode | false | Reports code that can never run. |
allowUnusedLabels | false | Reports labels that are never referenced. |
alwaysStrict | true | Parses every file in strict mode and emits "use strict". |
exactOptionalPropertyTypes | true | Distinguishes a missing optional property from one set to undefined. |
forceConsistentCasingInFileNames | true | Rejects imports whose path casing does not match the file on disk. |
isolatedModules | true | Ensures each file can be safely transpiled on its own. |
noEmitOnError | true | Suppresses all output when the build reports a type error. |
noFallthroughCasesInSwitch | true | Reports a switch case that falls through without break or return. |
noImplicitAny | true | Reports values whose type is silently inferred as any. |
noImplicitOverride | true | Requires the override keyword when a method overrides a base member. |
noImplicitReturns | true | Reports code paths in a function that do not return a value. |
noImplicitThis | true | Reports this with an implicit any type. |
noImplicitUseStrict | false | Leaves the standard "use strict" emit in place. |
noPropertyAccessFromIndexSignature | true | Requires bracket access for properties that come from an index signature. |
noUncheckedIndexedAccess | true | Adds undefined to the type of indexed access results. |
noUncheckedSideEffectImports | true | Reports side-effect imports that resolve to nothing. |
noUnusedLocals | true | Reports declared local variables that are never read. |
noUnusedParameters | true | Reports function parameters that are never read. |
skipLibCheck | false | Type-checks declaration files, overriding the essentials baseline. |
strict | true | Enables the full strict family of type-checking options. |
strictBindCallApply | true | Type-checks the arguments to bind, call, and apply. |
strictBuiltinIteratorReturn | true | Types built-in iterator return values precisely. |
strictFunctionTypes | true | Checks function parameters contravariantly for sound assignability. |
strictNullChecks | true | Treats null and undefined as distinct, non-assignable types. |
strictPropertyInitialization | true | Requires class properties to be assigned in the constructor. |
useDefineForClassFields | true | Emits class fields using the standard define semantics. |
useUnknownInCatchVariables | true | Types catch clause variables as unknown instead of any. |
info
allowSyntheticDefaultImports is kept true here on purpose. With skipLibCheck: false, TypeScript checks third-party declaration files such as Zod's .d.cts types, which use default-import syntax internally. Turning it off would surface errors in dependency types you do not control.
Related
- Review the layering order in TSConfig Best Practices.
- See how presets compose end to end in the Presets Overview.