Tighten type usage — replace lazy any / unknown with true types
Scan all TypeScript source under packages/**/src/ (and any root src/) and tighten type usage to honest, precise types. This is a type-safety / tech-debt cleanup — preserve runtime behavior, change only the types.
Rules:
- Replace
unknown with its true type. Keep unknown only where the value is genuinely unknown at compile time — e.g. parsed external JSON before validation, catch (e: unknown) clauses, or a deliberately dynamic public boundary. Lazy unknown used to dodge typing is not acceptable.
- Replace
any with its true type — or with unknown only if genuinely unknown. Never leave any.
- This includes annotations (
: any, : unknown), assertions (as any, as unknown as T), and generic args.
Acceptance:
pnpm typecheck passes (no new errors, no @ts-ignore/@ts-expect-error added to paper over).
pnpm lint passes (no new biome-ignore / eslint-disable).
- Tests still pass; no behavioral change.
Where a value really is unknown at the boundary, narrow it with a type guard or schema validation rather than asserting.
Tighten type usage — replace lazy
any/unknownwith true typesScan all TypeScript source under
packages/**/src/(and any rootsrc/) and tighten type usage to honest, precise types. This is a type-safety / tech-debt cleanup — preserve runtime behavior, change only the types.Rules:
unknownwith its true type. Keepunknownonly where the value is genuinely unknown at compile time — e.g. parsed external JSON before validation,catch (e: unknown)clauses, or a deliberately dynamic public boundary. Lazyunknownused to dodge typing is not acceptable.anywith its true type — or withunknownonly if genuinely unknown. Never leaveany.: any,: unknown), assertions (as any,as unknown as T), and generic args.Acceptance:
pnpm typecheckpasses (no new errors, no@ts-ignore/@ts-expect-erroradded to paper over).pnpm lintpasses (no newbiome-ignore/eslint-disable).Where a value really is unknown at the boundary, narrow it with a type guard or schema validation rather than asserting.