Instruction file imported from SafetyMP/Healthcare-Data-Exchange (
.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
web/is the Next.js clinician console (BFF → gateway :8081). Synthetic FHIR only.cd web && npm run verifyfor the UI gate.