browser-image-resizer icon indicating copy to clipboard operation
browser-image-resizer copied to clipboard

Included TypeScript Types

Open officiallyemma opened this issue 4 years ago • 3 comments

I added a typescript .d.ts header file so Typescript can automatically detect the readAndCompressImage method header. Without this, people using typescript receive errors about the module not including types.

officiallyemma avatar May 21 '21 17:05 officiallyemma

up for this, badly needed

jmrmgn avatar Jun 08 '21 08:06 jmrmgn

In the meantime, you can manually place /dist/index.js and /dist/index.d.ts together in a folder and manually target them in your TypeScript code.

- main.ts
- /browser-image-resizer
    - index.js
    - index.d.ts

in main.ts

// import this lib, making sure to target the LOCAL version with ./, and not the version in node_modules
import { readAndCompressImage, Config } from './browser-image-resizer'

~~OR you could just install my fork for this PR with npm i qwazwsx/browser-image-resizer. Although I would not recommend this for production as 1) this fork will not be maintained and 2) I'm going to delete it once this PR is merged, so please don't put it in your package.json~~ edit: as promised my fork has been deleted, please see upstream master branch

officiallyemma avatar Jun 08 '21 15:06 officiallyemma

Thanks for the workaround @qwazwsx, for now I'll use this library. react-image-file-resizer

jmrmgn avatar Jun 08 '21 15:06 jmrmgn