javascript - Typescript ไม่รู้ว่า FormData คืออะไร
เมื่อพยายามใช้ window.FormData ฉันได้รับข้อผิดพลาดดังต่อไปนี้:
The name 'FormData' does not exist in the current scope
สิ่งเดียวกันเกิดขึ้นกับ FileReader
คำตอบ #1
เพิ่ม dom ไปยังอาเรย์ lib ใน tsconfig.json ของโปรเจกต์ของคุณ
{
"compilerOptions": {
...
"lib": ["es2018", "dom"], // add `dom` to the array
...
}
}
