Typescript: bug: for..of tidak bekerja dengan NodeList

Dibuat pada 4 Nov 2016  ·  1Komentar  ·  Sumber: microsoft/TypeScript



Versi TypeScript: nightly (2.1.0-dev.201xxxxx)

Kode

// A *self-contained* demonstration of the problem follows...
for(const a of document.querySelectorAll('div')) {}

Perilaku yang diharapkan:
Itu harus dikompilasi.

Perilaku sebenarnya:
error TS2495: Type 'NodeListOf<Element>' is not an array type or a string type

Duplicate

Komentar yang paling membantu

image

>Semua komentar

image

Apakah halaman ini membantu?
0 / 5 - 0 peringkat