@anacare/tsconfig
v0.1.0
Published
Shared TypeScript configuration presets for the Ana Care platform monorepo. Five presets: base (strict baseline), library (publishable packages), nextjs, expo, nestjs. Published per ADR-0014.
Maintainers
Readme
@anacare/tsconfig — Shared TypeScript presets
Status: in use from day 0. This is the only
packages/*that has real content today; everything else is a placeholder until Round 8.
The single source of truth for TypeScript compiler configuration in the
monorepo. Every tsconfig.json in apps/* and packages/* (other than
@anacare/tsconfig itself) extends one of the presets here.
Presets
| Preset | Use in | Key differences from base |
|---|---|---|
| base.json | Not used directly — the canonical foundation that every other preset extends. | strict: true + the seven strict-extra flags. Bundler module resolution. ESM-friendly. |
| library.json | packages/* (other than this one) | Emits dist/, declarations, source maps. ESNext module. |
| nextjs.json | apps/web-admin, apps/client-dashboard | DOM lib. JSX preserve (Next compiles). noEmit: true. Next plugin. |
| expo.json | apps/mobile | React Native types. JSX react-jsx. noEmit: true. |
| nestjs.json | apps/api | CommonJS module. Node moduleResolution. Decorator metadata enabled. verbatimModuleSyntax: false (decorators need elision). |
How to extend
In a consumer tsconfig.json:
{
"extends": "@anacare/tsconfig/library",
"compilerOptions": {
// Only override what genuinely needs to be different.
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"]
}The extends path uses the package's exports field
(package.json). TypeScript 5+ resolves these natively.
Editing rules
- Changes to
base.jsonripple to every project. Open an ADR if the change tightens or loosens a strict flag. Loosening a flag is rarely the right answer; usually we add per-app// @ts-expect-errorwith a comment, or fix the code. - Per-app overrides belong in the app's own
tsconfig.json, not here. - Never remove a flag from
base.jsonwithout an ADR. The flags catch real bugs in clinical and financial code paths.
Why not just put presets in the repo root?
A package gives us:
- Versioning via Changesets — a breaking change to
base.jsonis amajorbump that consumers explicitly accept. - Clean import path (
@anacare/tsconfig/library) vs fragile relative paths (../../../tsconfig.base.json). - A natural place to add adjacent helpers (e.g.,
@anacare/tsconfig/typeswith shared ambient declarations) without sprawling the root.
