Good day.

This page stays with you, wherever you opened it.

Free Cursor rule

Strict TypeScript

Turn strict on. Handle every case in a union so a new case fails the build.

Download strict-typescript.mdc

The rule

---
description: TypeScript strict mode and exhaustive unions.
globs: "**/*.ts,**/*.tsx"
alwaysApply: false
---

# Strict TypeScript

- Keep `"strict": true`. Do not silence a new error with `any`.
- For a union, the default branch should assign the value to `never` so a new case breaks the build.
- Prefer a named type for a form payload over a bag of optional strings.
- Parse outside data at the boundary. Inside the app, the type should already be true.

How to use it

Copy the rule into .cursor/rules/strict-typescript.mdc in your own project. It is free to use. It is a working habit from [Wann Labs](/), the public notes of BrandMatchGrowth, not a promise that your codebase will pass an audit.

If you want the same standard applied to a product people pay for, book a working session. The public product that came out of this shop-and-software work is OpenSign.