Typescript types for @squoosh/lib
See original GitHub issueI am trying to use Typescript
to use @squoosh/lib
but getting the usual error when no types are available:
Could not find a declaration file for module '@squoosh/lib'. '/test/squoosh/node_modules/@squoosh/lib/build/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/squoosh__lib` if it exists or add a new declaration (.d.ts) file containing `declare module '@squoosh/lib';`ts(7016)
Are there are no types included for this library or could I doing something wrong?
Currently using
// @ts-ignore
import { ImagePool } from '@squoosh/lib';
as a workaround.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:7 (2 by maintainers)
Top Results From Across the Web
squoosh/lib missing types · Issue #1211
squoosh /lib does not have a types or typings field which makes using it in TypeScript projects very unpleasant.
Read more >squoosh/lib
A Node library for Squoosh. Latest version: 0.4.0, last published: a year ago. Start using @squoosh/lib in your project by running `npm i ......
Read more >Introducing libSquoosh - web.dev
We are happy to introduce libSquoosh, an experimental Node library on top of which the Squoosh CLI is built, giving you all the...
Read more >squoosh/lib - npm Package Health Analysis
libSquoosh is an experimental way to run all the codecs you know from the Squoosh web app directly inside your own JavaScript program....
Read more >ImageMinimizerWebpackPlugin
This plugin can use 4 tools to optimize/generate images: imagemin - optimize your images by default, since it is stable and works with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Totally @styfle! 😃
I was a bit skeptical to expose the types before improving the type definitions for
preprocess
andencode
functions since those take some complicated parameters and providing ts types without them felt a bit meaningless.So, I created a PR to add the parameter types to those https://github.com/GoogleChromeLabs/squoosh/pull/1141 and created another PR to expose the types https://github.com/GoogleChromeLabs/squoosh/pull/1142
Yeah, we don’t have full types for libSquoosh yet, only for some of the files. It’s an incremental migration that @ergunsh is working on 😃