TypeScript: problems with type system
var canvas = <HTMLCanvasElement> document.getElementById(“mycanvas”); var ctx = canvas.getContext(“2d”); or using dynamic lookup with the any type (no typechecking): var canvas : any = document.getElementById(“mycanvas”); var ctx = canvas.getContext(“2d”); You can look at the different types in lib.d.ts.