Instruction file imported from SafetyMP/CorpOS (
.github/instructions/typescript.instructions.md). Copyright stays with the author.
TypeScript coding standards (September 2026)
- Write TypeScript, not new application JavaScript. Leave existing tooling
.js/.mjs/.cjsfiles alone. - Place imports at the top of the module. Do not use inline
import()in function bodies except for a documented circular-dependency or optional-runtime case. - Prefer early returns over nested conditionals.
- On
switchover a discriminated union or enum, handle every variant. Use anevercheck indefaultso newly added variants fail at compile time. - Do not introduce
anyin new production code. Preferunknownplus narrowing. Do not use non-null assertions to silencestrictornoUncheckedIndexedAccess. - Match this repository's existing formatter and linter. Do not add a second style system.
- Keep public unions narrow. Do not widen a literal union to
stringwithout a spec change. - Do not weaken fail-closed, human-in-the-loop, tenancy, or verify gates to make types compile.
This repository
- Firm logic in
packages/core, HTTP inapps/api(Hono), UI inapps/console(Vite + Preact). - Do not introduce Express or
better-sqlite3. - Do not add LangGraph, CrewAI, or other graph/crew runtimes.
- Exception HITL stays default-off. Only tests/CI may pass
autoApproveException: true. - Never set
CORPOS_ALLOW_LIVEin CI. Default provider isSimulationProvider.