Typescript: bug: for..of does not work with NodeList

Created on 4 Nov 2016  ·  1Comment  ·  Source: microsoft/TypeScript



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

Code

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

Expected behavior:
It should compile.

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

Duplicate

Most helpful comment

image

>All comments

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlaberge picture dlaberge  ·  3Comments

DanielRosenwasser picture DanielRosenwasser  ·  3Comments

siddjain picture siddjain  ·  3Comments

uber5001 picture uber5001  ·  3Comments

Antony-Jones picture Antony-Jones  ·  3Comments