TypeScriptRule
by DUOMReport
Strict TypeScript rules: no any, types at boundaries, narrow unknown input, and keep types close to use.
Developer toolsLicense: CC0-1.0Updated yesterdayrule/typescript
Install
Run in your project folder (DuoM CLI: risk check, then write; undo with npx duom@1 undo)
npx duom@1 add rule/typescript --client claude-code
Writes to CLAUDE.md in your project (where Claude Code reads it). If the project has an AGENTS.md but no CLAUDE.md, DuoM creates CLAUDE.md starting with @AGENTS.md so Claude Code keeps reading it. Only the marked block is added; the rest of the file is left alone, and remove takes out only that block.
Manual: paste into CLAUDE.md
CLAUDE.md
<!-- duom:rule/typescript --> ## TypeScript - Keep "strict": true. Do not add any, @ts-ignore or non-null assertions (!) to silence an error; fix the type instead. - Data from outside (HTTP, files, env, JSON.parse) is unknown until validated, e.g. with zod. - Prefer type inference inside functions; write explicit types on exported functions and module boundaries. - Use union types and narrowing instead of enums and type casts. - Run tsc --noEmit (or the project's type-check script) after each change. <!-- /duom:rule/typescript -->
The rule
TypeScript
- Keep "strict": true. Do not add any, @ts-ignore or non-null assertions (!) to silence an error; fix the type instead.
- Data from outside (HTTP, files, env, JSON.parse) is unknown until validated, e.g. with zod.
- Prefer type inference inside functions; write explicit types on exported functions and module boundaries.
- Use union types and narrowing instead of enums and type casts.
- Run tsc --noEmit (or the project's type-check script) after each change.