Goal
ใช้ ArkType สำหรับ TypeScript runtime validation ด้วย type syntax โดยตรง
Scope
ใช้สำหรับ schema validation, type checking, และ type-safe validation ทั้ง compile-time และ runtime
Execute
1. Installation
ติดตั้ง ArkType ด้วย bun add arktype
2. Learn Basics
- อ่าน
guide/installation.mdสำหรับการติดตั้งและ setup - อ่าน
guide/quick-start.mdสำหรับเริ่มต้นใช้งาน
3. Understand Key Concepts
- อ่าน
key-concepts/overview.mdสำหรับแนวคิดหลัก - อ่าน
key-concepts/architecture.mdสำหรับสถาปัตยกรรม - อ่าน
key-concepts/match.mdสำหรับ pattern matching - อ่าน
key-concepts/declare.mdสำหรับ declare API - อ่าน
key-concepts/generics.mdสำหรับ generics
4. Apply Principles
- อ่าน
principles/best-practices.mdสำหรับ best practices
5. Advanced Guides
- อ่าน
guide/features.mdสำหรับ features ที่มี - อ่าน
guide/patterns.mdสำหรับ patterns ทั่วไป - อ่าน
guide/integration.mdสำหรับการ integrate กับ frameworks
6. Reference Documentation
- อ่าน
references/api.mdสำหรับ API reference - อ่าน
references/configuration.mdสำหรับ configuration options - อ่าน
references/website.mdสำหรับ official resources
Rules
- ใช้
bun add arktypeสำหรับ installation - ใช้
bun add -D arktypeสำหรับ dev dependencies - ใช้ backticks สำหรับ
type(),match(),declare(), commands - ใช้ code blocks สำหรับ schema examples
- ใช้ type inference จาก ArkType เสมอ
- หลีกเลี่ยง type assertions ที่ไม่จำเป็น
- ใช้
type()สำหรับ schema definitions - ใช้
match()สำหรับ pattern matching - ใช้ ArkType สำหรับ performance-critical validation
- หลีกเลี่ยง redundant validations
- ใช้ caching สำหรับ repeated validations
- ตั้งค่า TypeScript strict mode ใน
tsconfig.json - ตั้งค่า VSCode quickSuggestions สำหรับ strings
- ใช้ Standard Schema integration เมื่อจำเป็น
Expected Outcome
- Schema validation ที่รวดเร็วและแม่นยำ
- Type-safe code ทั้ง compile-time และ runtime
- Code ที่ maintainable และ consistent
- Performance ที่ optimized