scaleflex / react-cloudimage-responsive

Cloudimage Responsive will smartly resize, compress and accelerate images across the World in your site for all devices. The plugin supports lazy loading technique with fancy animation on image load. Any questions or issues, please report to https://github.com/scaleflex/react-cloudimage-responsive/issues
MIT License
45 stars 15 forks source link

Supports for React v18+ with Typescript #27

Open CamboimGabriel opened 1 year ago

CamboimGabriel commented 1 year ago

If we try to use it causes an error

image
unitedustom commented 1 year ago

Yeah i'm getting the same problem when trying to use it with Typescript.

davepenfold commented 5 months ago

Hello, I can offer some suggestions, I have two questions about the type definitions for this project:

  1. https://github.com/scaleflex/react-cloudimage-responsive/blob/26be77afcae525de820f0ff148bf23e2d20291de/index.d.ts#L33 Shouldn't doNotReplaceURL be an optional property like all the others? If this property is omitted it causes a TS error.
  2. https://github.com/scaleflex/react-cloudimage-responsive/blob/26be77afcae525de820f0ff148bf23e2d20291de/index.d.ts#L22 children property is not defined here, I believe it should be? This is what is likely causing the TS error provided in this issue. It could be of type React.ReactNode ?