flow
โดย facebook
การตรวจสอบชนิดข้อมูลแบบคงที่สำหรับโค้ด React ทั้งบน DOM และแพลตฟอร์มเนทีฟ มีตัวเลือกเรนเดอร์สี่แบบครอบคลุม DOM มาตรฐาน โค้ดเฉพาะเบราว์เซอร์ React Native และสภาพแวดล้อม Fabric รัน yarn flow พร้อมอาร์กิวเมนต์เรนเดอร์เสริม ใช้ yarn flow-ci สำหรับการตรวจสอบที่ครอบคลุมแต่ช้ากว่า รายงานข้อผิดพลาดชนิดข้อมูลพร้อมตำแหน่งไฟล์เพื่อช่วยระบุและแก้ไขปัญหาได้อย่างรวดเร็ว ระวังข้อผิดพลาดทั่วไป: การไม่ระบุเรนเดอร์ การละเลยการตรวจสอบ $FlowFixMe และการนำเข้าชนิดข้อมูลที่ไม่ถูกต้อง
npx skills add https://github.com/facebook/react --skill flowFlow Type Checking
Arguments:
- $ARGUMENTS: Renderer to check (default: dom-node)
Renderers
| Renderer | When to Use |
|---|---|
dom-node | Default, recommended for most changes |
dom-browser | Browser-specific DOM code |
native | React Native |
fabric | React Native Fabric |
Instructions
- Run
yarn flow $ARGUMENTS(usedom-nodeif no argument) - Report type errors with file locations
- For comprehensive checking (slow), use
yarn flow-ci
Common Mistakes
- Running without a renderer - Always specify or use default
dom-node - Ignoring suppressions - Check if
$FlowFixMecomments are masking real issues - Missing type imports - Ensure types are imported from the correct package