TypeScript
TypeScript copied to clipboard
Missing .data member on Node in lib.d.ts
HTML nodeType 8 (Comment) have a .data attribute that hold they content. It's missing from the Node declaration in lib.d.ts, currently there's no workaround if you have --noImplicitAny turned on, having to rely on var node:any; instead of var node:Node;. Using node['data'] gives the error TS7017:Index signature of object type implicitly has an 'any' type.
The .data property is actually part of the CharacterData interface, not of Node. Declare the variable as Comment, or use the .nodeValue property instead.
Confirmed @jeffreymorlan's comment - see https://dom.spec.whatwg.org/#interface-characterdata