I am converting my BabylonJS project to Typescript. Having trouble with one conversion:
With the following code:
var planeTexture = new DynamicTexture('dynamic texture', 512, scene, true)
let textureContext = planeTexture.getContext()
planeTexture.getContext() calls this._canvas.getContext("2d") as you can see here (line 36 /src/Materials/Textures/babylon.dynamicTexture.ts).
Returning actually one of these I am assuming: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
In BabylonJS, however, it looks like an interface with just a few properties (line 77: /src/babylon.mixins.ts).
So, my problem is that my project won't compile if I want to call methods not in the mixin and I can't seem to cast to CanvasRenderingContext2D (since first property on CanvasRenderingContext2D 'canvas' is missing). I'd like to call save(), restore(), fillStyle, etc. It was working in javascript, but does anybody know how to do that in Typescript?