ไม่มีใครรู้วิธีการส่งใน TypeScript หรือไม่
ฉันพยายามทำสิ่งนี้:
var script:HTMLScriptElement = document.getElementsByName("script")[0];
alert(script.type);
แต่มันทำให้ฉันมีข้อผิดพลาด:
Cannot convert 'Node' to 'HTMLScriptElement': Type 'Node' is missing property 'defer' from type 'HTMLScriptElement'
(elementName: string) => NodeList
ฉันไม่สามารถเข้าถึงสมาชิก 'ประเภท' ขององค์ประกอบสคริปต์ได้เว้นแต่ฉันจะแปลงเป็นประเภทที่ถูกต้อง แต่ฉันไม่ทราบวิธีการทำเช่นนี้ ฉันค้นหาเอกสารและตัวอย่าง แต่ฉันไม่พบอะไรเลย