Skip to content

DomTokenList has no method "forEach" #25968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marvinside opened this issue Jul 26, 2018 · 2 comments
Closed

DomTokenList has no method "forEach" #25968

marvinside opened this issue Jul 26, 2018 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue

Comments

@marvinside
Copy link

marvinside commented Jul 26, 2018

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

@cevek
Copy link

cevek commented Jul 26, 2018

Also it needs to be added: supports, entries, keys, values
https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList

@mhegazy mhegazy added Bug A bug in TypeScript Fixed A PR has been merged for this issue Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet labels Jul 26, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jul 26, 2018

Should be fixed by #25944

@mhegazy mhegazy self-assigned this Jul 26, 2018
@mhegazy mhegazy added this to the TypeScript 3.1 milestone Jul 26, 2018
@mhegazy mhegazy removed the Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet label Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants