TypeScript Policy
Guardrails
- TypeScript everywhere (apps & packages)
strictmode ON (noImplicitAny,exactOptionalPropertyTypes, ...)- ESM‑first modules
- Path aliases + Project References
- No decorators
Base tsconfig excerpt:
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"jsx": "react-jsx",
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": { "@repo/*": ["packages/*/src"], "@ui/*": ["packages/ui/src/*"] }
},
"include": ["apps", "packages"]
}
Library build tool: tsup:
{ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { "build": "tsup src/index.ts --dts --format esm,cjs" } }
LLM Notes
- Output ESM unless a dependency requires CJS; for dual-builds, ship both.
- Respect path aliases. Import from
@repo/*rather than deep relative paths.