Declarative .mdcQuy tắc Cursor/Claude/Windsurf & quy trình làm việc n8nQuy tắc IDEĐã kiểm tra rò rỉ bí mật
TypeScript 5.8 Chế độ nghiêm ngặt, Quy tắc xác thực không có bất kỳ & ranh giới nào
Quy tắc IDE khai báo thực thi strictNullChecks, noUncheckedIndexedAccess, các liên kết phân biệt đối xử và phân tích cú pháp ranh giới JSON thời gian chạy trên các monorepos TypeScript.
Tệp quy tắc IDE & Tác nhân khai báo
---
description: TypeScript 5.8 strict type-safety, discriminated unions, and zero-any API boundaries
globs: **/*.{ts,tsx}
alwaysApply: true
---
# TypeScript 5.8 Strict Type-Safety Constitution
- Enable `"strict": true`, `"noUncheckedIndexedAccess": true`, and `"noImplicitOverride": true` in every `tsconfig.json`.
- NEVER use `any` or double-cast `as unknown as T`; type untrusted network/JSON inputs as `unknown` and narrow with explicit schema validators.
- Model async UI states and domain events as discriminated unions (`{ status: 'loading' } | { status: 'ok'; data: T } | { status: 'error'; message: string }`).
- Use `import type { ... }` for type-only imports so bundlers elide compile-time declarations deterministically.
- Enforce exhaustive `switch` checks using a `never` helper in `default` branches.
## Verification Check
```bash
npx tsc --noEmit --pretty false
```Ghi chú Thiết lập Cộng đồng & Đánh giá Sản xuất (0)
Chưa có ghi chú cộng đồng nào. Chia sẻ mẹo cấu hình sản xuất của bạn bên dưới.
Trình kiểm tra lược đồ tài nguyên và công cụ MCP
| Mã định danh công cụ/tài nguyên | Thông số đầu vào | Hành vi thực thi |
|---|---|---|
| forbid_explicit_any | **/*.{ts,tsx} | Replaces any and unsafe as casts with unknown + narrowed type guards. |