Skip to content

Can't iterate over DOM elements even with dom.iterable #15236

@seivan

Description

@seivan

I might have missed something here. Feel free to close this ticket if it's related to #4947

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)

Code

tsconfig.json

    "compilerOptions": {
        "outDir": "./dist/",
        "sourceMap": true,
        "noImplicitAny": false,
        "suppressImplicitAnyIndexErrors": true,
        "module": "commonjs",
        "target": "es5",
        "strictNullChecks": true,
        "experimentalDecorators": true,
        "jsx": "react",
        "lib" : ["dom","es6","dom.iterable","scripthost", "es2015.iterable", "es2015.collection"],
        "alwaysStrict": true,
        "removeComments": true,
        "emitDecoratorMetadata": false,
        "noEmitHelpers" : false,
        "importHelpers" : true,
        "allowJs": true,
        "forceConsistentCasingInFileNames": true,
        "noUnusedLocals": false

    },
const myNodeListOfBrs = document.querySelectorAll("br")
myNodeListOfBrs.forEach(element => {
  console.log(element);            
});

Expected behavior:
It should compile

Actual behavior:
It does not compile with error: property 'forEach' does not exist on type 'NodeListOf<HTMLBRElement>

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions