Chuyển đến nội dung
Skillpedia
Lập trình chung75k · #3068

typescript-strict-mode

Skill này làm gì

Skill này kiểm tra cài đặt của dự án TypeScript và bật chế độ kiểm tra kiểu nghiêm ngặt. Skill dành cho lập trình viên muốn trình biên dịch bắt được nhiều lỗi hơn trước khi mã chạy.

Khi nào nên dùng

  • ✓Khi một dự án TypeScript không có cài đặt strict trong tsconfig.json.
  • ✓Khi một codebase có lỗi null hoặc kiểu any ngầm định.
  • ✓Khi bắt đầu một dự án TypeScript mới và chọn các cài đặt an toàn nhất.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/typescript-strict-mode/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/typescript-strict-mode/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi có một dự án TypeScript. Bạn có thể kiểm tra tsconfig và bật chế độ strict nếu an toàn không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent đọc file tsconfig và kiểm tra các cờ strict nào đang bật. Agent bật những cờ còn thiếu, hoặc bật từng bước nếu mã hiện có quá nhiều lỗi kiểu.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Enable TypeScript strict mode in tsconfig.json

Without strict mode, TypeScript allows implicit any types, ignores possible null/undefined values, and silently accepts unsound function assignments — meaning the type system gives a false sense of safety. Enabling strict mode makes TypeScript catch the bugs it was designed to prevent, turning type errors into compile-time failures rather than runtime surprises in production.

Quick Reference

  • "strict": true enables strictNullChecks, noImplicitAny, and six other checks
  • Enable strict from project start — retrofitting a large codebase is painful
  • On existing projects: enable strictNullChecks first, then other flags incrementally
  • Strict mode eliminates entire classes of null reference and implicit-any bugs

Check

Inspect the tsconfig.json in this project and report whether "strict": true (or individual strict flags) is enabled. List any missing strict flags.

Fix

Add "strict": true to the compilerOptions in tsconfig.json. If the project has existing type errors, explain how to enable strictNullChecks first as a stepping stone.

Explain

Explain what TypeScript strict mode enables, which individual flags it activates, and why each flag matters for catching real bugs.

Code Review

Check whether the codebase relies on implicit any, unchecked null access, or loose function type assignments that strict mode would reject. Flag the specific patterns and show what stricter types would look like.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/javascript/typescript-strict-mode

Câu hỏi thường gặp

Chế độ strict bật những gì?

Nó bật một nhóm kiểm tra, gồm strictNullChecks và noImplicitAny, giúp bắt các lỗi thường gặp.

Nếu dự án của tôi có nhiều lỗi kiểu thì sao?

Skill khuyên bật strictNullChecks trước, rồi bật từng cờ khác một.

Bật strict ngay từ đầu có dễ hơn không?

Skill nói rằng bật chế độ strict ngay từ đầu dễ hơn nhiều so với phải sửa lại một dự án lớn sau này.

Chi tiết

Mô tả gốc của tác giả

Use when setting up a new TypeScript project, auditing an existing tsconfig.json, or reviewing code where null-reference errors or implicit any types are present.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#3068
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự