Closed snowfrogdev closed 1 month ago
Thanks for the suggestion, I made the change to types for all the draw functions, will rebuild soon. I'm not sure how to set the type signature of the draw function using jsdoc though, will take a look at that when i get a chance.
Here is the change...
https://github.com/KilledByAPixel/LittleJS/commit/aa52f6249f8e754b6f6a5f57f1f4c9eee7fde01a
This is the current function signature in TypeScript:
I'd like to propose changing it to
This allows for the passing of an offscreen canvas, as well as a regular canvas. It also improves the typing of
drawFunction
such thatctx
will now be correctly typed and inferred based on what is passed tocontext
. If nothing is passed, if defaults toCanvasRenderingContext2D
since LJS will use the mainCanvasContext by default.I'd be happy to make a PR if this is deemed a worthy improvement.