Open tomgallagher opened 3 years ago
@tomgallagher, are you still having this issue or did you find a way around it?
For anyone else who stumbles into this when running tsc
fails for them:
Update your tsconfig.json
to include DOM
as a lib
. Why does this work? Because CanvasRenderingContext2D
is a globally available type in the DOM
and including this library allows TypeScript to resolve the type reference.
// ... other config ...
"lib": [
"DOM",
// ... others libs
],
// ... other config ...
@GioCirque - I think I just built that file in JS in the end. Can't remember. But you can close the issue. Thanks for reply.
I also had to cast a Buffer
to any
because, it seems, the types are defined for web only, and the addFrame
signature only takes a CanvasRenderingContext2D
.
@GioCirque I am trying to use this project in typescript but even the new Gifencoder
method failed.
Do you any clue how to get that working?
You can check out my full, working TypeScript implementation over here. I recently started seeing some interesting outputs so I'm exploring a new implementation. I'll let you know if anything comes from it.
!!!WARNING !!!
DO NOT assign your GIFEncoder
instance to undefined
after calling finish()
. I've observed this clearing the entire GIF on disk and leaving a nearly empty file with just a GIF89a
header inside.
@kavimaluskam If you're interested, you can also see how I'm adding images via context (maybe overkill) in the snapshotEvent function and the simple finalization in the maybeFinalizeGif function
Thank you so much @GioCirque , it definitely helped. 🚀
Hey
Thanks for the library - helped me out of a tight spot.
Getting this error when compiling with Typescript.
Any thoughts?
Tom