📄️ Cấu hình tsconfig.json
Node.js không tự support TypeScript, nên khi đưa TypeScript vào cần có file cấu hình TypeScript là tsconfig.json.
📄️ Danh sách option
Danh sách option của TSConfig
📄️ strict
Bật hàng loạt các option thuộc nhóm strict
📄️ noImplicitAny
Cấm any type ngầm định
📄️ strictNullChecks
Làm nghiêm ngặt check null và undefined
📄️ strictFunctionTypes
Làm nghiêm ngặt check variance của parameter type
📄️ strictBindCallApply
Làm nghiêm ngặt type check của bind, call, apply
📄️ strictPropertyInitialization
Bắt buộc khởi tạo class property
📄️ noImplicitThis
Bắt buộc type annotation cho this
📄️ useUnknownInCatchVariables
Xử lý e trong catch(e) bắt exception là unknown type
📄️ alwaysStrict
Bật chế độ strict mode của JavaScript
📄️ noUnusedLocals
Cấm biến không được sử dụng
📄️ noUnusedParameters
Cấm tham số không được sử dụng
📄️ exactOptionalPropertyTypes
Cấm gán undefined cho optional property
📄️ noImplicitReturns
Kiểm tra xem tất cả các nhánh của function đều có `return` đúng cách hay không
📄️ noFallthroughCasesInSwitch
Cấm fallthrough trong switch statement
📄️ noUncheckedIndexedAccess
Bắt buộc check undefined khi tham chiếu property của index type hoặc phần tử array
📄️ noImplicitOverride
Bắt buộc dùng override keyword khi override method
📄️ noPropertyAccessFromIndexSignature
Bắt buộc dùng [] khi tham chiếu property của index type
📄️ isolatedModules
Hỗ trợ các module được compile riêng lẻ