Skip to content

DomTokenList has no method "forEach" #25968

Closed
@marvinside

Description

@marvinside

TypeScript Version: 3.1.0-dev.20180726
Search Terms: DomTokenList forEach classList

Code

const body:HTMLElement = document.body;

body.classList.forEach((attr)=>{
	/* Some code */
);

Expected behavior:
File just Compiles wwithout generating an error according to https://developer.mozilla.org/de/docs/Web/API/DOMTokenList/forEach
Actual behavior:

client/main.ts:24:20 - error TS2339: Property 'forEach' does not exist on type 'DOMTokenList'.

24                      body.classList.forEach((attr)=>{
                                       ~~~~~~~

Playground Link:
https://www.typescriptlang.org/play/#src=.....

The file from where VS Code loads the DOMTokenList is: /usr/share/code/resources/app/extensions/node_modules/typescript/lib/lib.dom.d.ts

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions