transitive-bullshit / puppeteer-lottie

Renders Lottie animations via Puppeteer to image, GIF, or MP4.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

working with typescript

tgeconf opened this issue · comments

commented

I am trying to use this in a typescript project. But I just can't make it work. Is it possible to use this in typescript?

It's a normal JS package that should definitely be usable via TS.

If you can give more info on the errors or issues you're running into, that'd be helpful.

commented

Sorry I am new in writing declaration files. Dont know if this is the case. I just wrote a rough declaration file like:
declare module 'puppeteer-lottie' { const func: (opts: any) => Promise<any> export default func; }

and I got errors:

`ERROR in ./node_modules/cross-spawn/index.js
Module not found: Error: Can't resolve 'child_process' in 'C:\workspace\github\CanisGEditor\node_modules\cross-spawn'
@ ./node_modules/cross-spawn/index.js 3:11-35
@ ./node_modules/execa/index.js
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/execa/index.js
Module not found: Error: Can't resolve 'child_process' in 'C:\workspace\github\CanisGEditor\node_modules\execa'
@ ./node_modules/execa/index.js 3:21-45
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/puppeteer-lottie/index.js
Module not found: Error: Can't resolve 'child_process' in 'C:\workspace\github\CanisGEditor\node_modules\puppeteer-lottie'
@ ./node_modules/puppeteer-lottie/index.js 11:18-42
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/cross-spawn/lib/util/readShebang.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\cross-spawn\lib\util'
@ ./node_modules/cross-spawn/lib/util/readShebang.js 3:11-24
@ ./node_modules/cross-spawn/lib/parse.js
@ ./node_modules/cross-spawn/index.js
@ ./node_modules/execa/index.js
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/fs-extra/lib/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\fs-extra\lib'
@ ./node_modules/fs-extra/lib/index.js 23:11-24
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\graceful-fs'
@ ./node_modules/graceful-fs/graceful-fs.js 1:9-22
@ ./node_modules/fs-extra/lib/fs/index.js
@ ./node_modules/fs-extra/lib/index.js
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/isexe/windows.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\isexe'
@ ./node_modules/isexe/windows.js 4:9-22
@ ./node_modules/isexe/index.js
@ ./node_modules/which/which.js
@ ./node_modules/cross-spawn/lib/util/resolveCommand.js
@ ./node_modules/cross-spawn/lib/parse.js
@ ./node_modules/cross-spawn/index.js
@ ./node_modules/execa/index.js
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/isexe/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\isexe'
@ ./node_modules/isexe/index.js 1:9-22
@ ./node_modules/which/which.js
@ ./node_modules/cross-spawn/lib/util/resolveCommand.js
@ ./node_modules/cross-spawn/lib/parse.js
@ ./node_modules/cross-spawn/index.js
@ ./node_modules/execa/index.js
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/isexe/mode.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\isexe'
@ ./node_modules/isexe/mode.js 4:9-22
@ ./node_modules/isexe/index.js
@ ./node_modules/which/which.js
@ ./node_modules/cross-spawn/lib/util/resolveCommand.js
@ ./node_modules/cross-spawn/lib/parse.js
@ ./node_modules/cross-spawn/index.js
@ ./node_modules/execa/index.js
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/jsonfile/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\jsonfile'
@ ./node_modules/jsonfile/index.js 5:8-21
@ ./node_modules/fs-extra/lib/json/jsonfile.js
@ ./node_modules/fs-extra/lib/json/index.js
@ ./node_modules/fs-extra/lib/index.js
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/ow/dist/source/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\ow\dist\source'
@ ./node_modules/ow/dist/source/index.js 1:27109-27122
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/temp-dir/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\temp-dir'
@ ./node_modules/temp-dir/index.js 2:11-24
@ ./node_modules/tempy/index.js
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/tempy/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\workspace\github\CanisGEditor\node_modules\tempy'
@ ./node_modules/tempy/index.js 2:11-24
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/ora/index.js
Module not found: Error: Can't resolve 'readline' in 'C:\workspace\github\CanisGEditor\node_modules\ora'
@ ./node_modules/ora/index.js 2:17-36
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts

ERROR in ./node_modules/puppeteer/lib/WebSocketTransport.js
Module not found: Error: Can't resolve 'ws' in 'C:\workspace\github\CanisGEditor\node_modules\puppeteer\lib'
@ ./node_modules/puppeteer/lib/WebSocketTransport.js 16:18-31
@ ./node_modules/puppeteer/lib/Launcher.js
@ ./node_modules/puppeteer/lib/Puppeteer.js
@ ./node_modules/puppeteer/index.js
@ ./node_modules/puppeteer-lottie/index.js
@ ./src/components/nav.ts
@ ./src/app.ts`

have u tried only declare module "puppeteer-lottie";?