Centralize Type Definitions
typingscommandsetup L1★14
wellwelwel/sessioner ↗What it does
Centralize types in src/types.ts with strict TypeScript enforcement
Best for
Type-safe systems with strict indexed access guards when runtime errors from undefined array access must be eliminated at compile time.
Inputs
- · Project with tsconfig noUncheckedIndexedAccess enabled
Outputs
- · src/types.ts with all domain, UI, session, analysis, stats types
- · No type defined outside types.ts file
- · Type guards enforcing undefined checks on indexed access
- · npm run typecheck passes with zero errors
Requires
- · TypeScript 5+
- · Biome linter (for 2-space indent, single quotes)
Preconditions
- · TypeScript project with strict mode enabled
- · tsconfig.json with noUncheckedIndexedAccess: true
- · src/types.ts file exists and is writable
Failure modes
- · Type defined outside types.ts = import fails or linter error
- · any used anywhere = typecheck error (zero tolerance)
- · interface instead of type = convention violation
- · Non-null assertion (!) used = defeats undefined checks
- · Indexed access without guard = 'T | undefined' required
Trust signals
- · Enforces zero 'any' usage (compile-time catch)
- · Requires explicit guards for indexed access (no ! assertions)
- · Type catalog documented with domain semantics
- · Single source of truth for all types (no duplication)