Included TypeScript Types
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.
up for this, badly needed
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
Thanks for the workaround @qwazwsx, for now I'll use this library. react-image-file-resizer