Adding existing functions in TypeScript: Node.getAttribute()
问题 What is the best way to add a function to typescript that actually exists already? In my case this is Node.getAttribute() , which is actually built-in to the browser, but not yet recognized by TypeScript. It errors: Cannot find property 'getAttribute' on type 'Node'. In my case I ran into this error executing the following: var xmlDocument = new DOMParser().parseFromString(xmlString, "text/xml"), rootfile = xmlDocument.getElementsByTagName("aNode")[0]; console.log(rootfile.getAttribute(