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

Unable to use browser image resizer

Open ghost opened this issue 3 years ago • 1 comments

** Could not find a declaration file for module 'browser-image-resizer'. 'E:/Angular/travelgram/node_modules/browser-image-resizer/dist/index.js' implicitly has an 'any' type.**

Unable to user browser image resizer: even though the module is present but it is showing is not present.

Please see the video ref: https://monosnap.com/direct/qbpKBmUth9pjpobJ0HzqtlH2ATs59i

image

ghost avatar Aug 20 '21 09:08 ghost

Yeah there are no types, would be great to add them.

The solution for now is to define them yourself e.g. in a file src/@types/browser-image-resizer/index.d.ts

declare module 'browser-image-resizer' {
  interface Config {
    quality: number
    maxWidth: number
    maxHeight: number
    autoRotate: boolean
    debug: boolean
    mimeType: 'image/jpeg' | 'image/png'
  }

  export function readAndCompressImage(file: File, userConfig?: Partial<Config>): Promise<Blob>
}

vojtechsimetka avatar Dec 14 '21 11:12 vojtechsimetka

Types added in v2.3.0 thanks to #40, check it out and lmk if you continue to encounter issues

ericnograles avatar Sep 18 '22 12:09 ericnograles