I am making a DOM based game for the first time. I would like to extend HTMLDivElement, however in TypeScript, HTMLDivElement is an Interface.
I would like to do this p
Also you can 'extend' the HTMLDivElement interface with data members if you wish, not by using extends since it is not a class, but by adding it via the interface. TypeScript interfaces are 'open ended', see page 85 of the spec under 'declaration merging'.
http://www.typescriptlang.org/Content/TypeScript%20Language%20Specification.pdf
for example, the below adds the member 'mydata' of type string to the HTMLDivElement interface.
interface HTMLDivElement {
mydata : string;
}
// now we can assign a value
var div = document.getElementById("myDiv");
div.mydata = "test";