Awesome-Image-Viewer icon indicating copy to clipboard operation
Awesome-Image-Viewer copied to clipboard

TS error: Property 'index' comes from an index signature

Open RaminGe opened this issue 1 year ago • 2 comments

Hey there,

thanks for this simple and easy to use image viewer! I found one issue with the package added to my Angular 16 project which is the following error message:

Error: node_modules/awesome-image-viewer/src/imageViewer.ts:265:43 - error TS4111: Property 'index' comes from an index signature, so it must be accessed with ['index'].

265                 const index = tar.dataset.index;
                                              ~~~~~


Error: node_modules/awesome-image-viewer/src/imageViewer.ts:290:44 - error TS4111: Property 'url' comes from an index signature, so it must be accessed with ['url'].

290         const url = imageContainer.dataset.url;
                                               ~~~

The workaround right now is to just edit the tsconfig.json:

"compilerOptions": {
  "noPropertyAccessFromIndexSignature": false,
}

However, would be nice to change replace those lines.

RaminGe avatar Jul 21 '23 10:07 RaminGe

Hi @RaminGe Happy to see it's useful for you, I'll check the error soon. Thanks for your feedback. ✌✌✌

MostafaMDZH avatar Aug 07 '23 13:08 MostafaMDZH

@MostafaMDZH I have created a small PR to address this issue :) Might look into #3 if I have time

RaminGe avatar Aug 08 '23 13:08 RaminGe