Skip to content
เข้าสู่ระบบ

ES Modules

TypeScript 5.9 รองรับ ES Modules อย่างเต็มรูปแบบ รวมถึงฟีเจอร์ใหม่อย่าง import defer ที่ช่วยให้ lazy load modules ได้ง่ายขึ้น

ประเภทของ Exports/Imports

Section titled “ประเภทของ Exports/Imports”
ประเภทSyntaxUse Case
Named Exportexport { name }หลายๆ exports ต่อไฟล์
Default Exportexport defaultmain export ของไฟล์
Type Exportexport type { }types เท่านั้น (ถูกลบตอน compile)
Barrel Exportexport * fromre-export จาก submodules
Diagram

เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม

ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด