I\'m just testing typescript in VisualStudio 2012 and have a problem with its type system. My html site has a canvas tag with the id \"mycanvas\". I\'m trying to draw a rect
This is an old topic... maybe dead to 2012, but exciting and new to VS Code and typescript.
I had to do the following to get this to work in VS Code with the following package references.
const demoCanvas: HTMLCanvasElement = document.getElementById('rfrnCanvas') as any;
if(demoCanvas.getContext) {
const context = demoCanvas.getContext('2d');
if(context) {
reactangle(context);
}
}
Typescript Version:
{
"@typescript-eslint/eslint-plugin": "^2.29.0",
"@typescript-eslint/parser": "^2.29.0",
"typescript": "^3.7.5"
}