Skip to content

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

@RaminGe

Description

@RaminGe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions