Skip to main content

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?

  1. Turns on strict and every individual strict flag so the compiler enforces null safety, typed this, and sound function types.
  2. Flags unused locals, parameters, unreachable code, and unused labels so dead code never ships.
  3. Enforces exactOptionalPropertyTypes and noUncheckedIndexedAccess so optional and indexed values are handled explicitly.
  4. Sets isolatedModules and noEmitOnError so files stay safe to transpile per-file and a failed check never emits output.
  5. Overrides the baseline skipLibCheck to false so 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.

tsconfig.json
json
{
  "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.

SettingValueDescription
allowArbitraryExtensionsfalseBlocks importing files with non-standard extensions as modules.
allowSyntheticDefaultImportstrueKeeps default imports from no-default modules working under skipLibCheck: false.
allowUnreachableCodefalseReports code that can never run.
allowUnusedLabelsfalseReports labels that are never referenced.
alwaysStricttrueParses every file in strict mode and emits "use strict".
exactOptionalPropertyTypestrueDistinguishes a missing optional property from one set to undefined.
forceConsistentCasingInFileNamestrueRejects imports whose path casing does not match the file on disk.
isolatedModulestrueEnsures each file can be safely transpiled on its own.
noEmitOnErrortrueSuppresses all output when the build reports a type error.
noFallthroughCasesInSwitchtrueReports a switch case that falls through without break or return.
noImplicitAnytrueReports values whose type is silently inferred as any.
noImplicitOverridetrueRequires the override keyword when a method overrides a base member.
noImplicitReturnstrueReports code paths in a function that do not return a value.
noImplicitThistrueReports this with an implicit any type.
noImplicitUseStrictfalseLeaves the standard "use strict" emit in place.
noPropertyAccessFromIndexSignaturetrueRequires bracket access for properties that come from an index signature.
noUncheckedIndexedAccesstrueAdds undefined to the type of indexed access results.
noUncheckedSideEffectImportstrueReports side-effect imports that resolve to nothing.
noUnusedLocalstrueReports declared local variables that are never read.
noUnusedParameterstrueReports function parameters that are never read.
skipLibCheckfalseType-checks declaration files, overriding the essentials baseline.
stricttrueEnables the full strict family of type-checking options.
strictBindCallApplytrueType-checks the arguments to bind, call, and apply.
strictBuiltinIteratorReturntrueTypes built-in iterator return values precisely.
strictFunctionTypestrueChecks function parameters contravariantly for sound assignability.
strictNullCheckstrueTreats null and undefined as distinct, non-assignable types.
strictPropertyInitializationtrueRequires class properties to be assigned in the constructor.
useDefineForClassFieldstrueEmits class fields using the standard define semantics.
useUnknownInCatchVariablestrueTypes 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.