How to get TS support for this package?
I want to use jimp-compact instead of jimp, but I also want to use the type support provided by @types/jimp. How do I do it?
Hi @albertodiazdorado. I didn't try but can you please try adding "jimp": "npm:jimp-compat" to dependencies of package.json as a workaround? It should work by replacing package but importing jimp
Thanks for the answer @pi0 ! Sadly, I have realised that @types/jimp has jimp as a dependency... hence, we are considering dropping the types completely, or switching to jimp.
I will let you know if "jimp": "npm:jimp-compat" works, though :)
jimp ships with types, so that won't work.
Integrating something like https://api-extractor.com/ might be a good idea 🙂
Workaround for us is jimp as a dev dependency, then in a types.d.ts
declare module 'jimp-compact' {
import jimp = require('jimp');
export = jimp;
}
Version 0.16.1-1 contains a quick fix so as long as you install jimp in devDependencies, types can work for jimp-compact import without the need of alias or ts shim.

Integrating something like https://api-extractor.com/ might be a good idea 🙂
Thanks for suggestion. I tried few rollup plugins as well as api-extractor but seems little bit tricky. If interested you can track progress at https://github.com/unjs/jimp-compact/pull/42
Cool, can remove our own declare module 'jimp-compact' with that 👍
I'm hoping you can get api-extractor (or something similar) to work so we can also drop the dev dep 😀 (for my use case this is perfectly fine though, as the types are only used for dev, and it's more the require time than yarn install time we wanna improve by using this module)