Closed alexgleason closed 1 month ago
The type errors about numbers vs strings are right and I've fixed them, it will be out with next release. It was a matter of returning number suffixed with px and accepting them too. Though most of these errors do not mean incompatibility with the web. In some cases we support more properties (eg Path2D, FontStretch, ImageData) which causes the mismatch between types, and in some cases our types have less properties so only to support 2D canvas while web has more to offer (DOMMatrix is very primitive, just has a-f fields not all 4x4 fields, and drawing image only supports taking Image object not a canvas). There are some fields where a custom value is not supported so only auto is allowed and hence the mismatch. It is never going to not error if you just bring in web types.
I've released the fix in v0.5.7 for a part of it, rest of it seems to be as intended.
I threw
/// <reference lib="dom" />
at the top ofcontext2d.ts
and changed:The file is then full of type errors. Mainly about things that should be strings vs numbers, etc.
After some edits: