cornerstone3D icon indicating copy to clipboard operation
cornerstone3D copied to clipboard

[Bug] Could not find a declaration file for module '@cornerstonejs/dicom-image-loader' in Angular 17

Open ArnaudAgixis opened this issue 11 months ago • 7 comments

Describe the Bug

When I try to reproduce an example that use dicom-image-loader like this one : DICOM P10 from local file system, the package is not found. I try to install it with npm and yarn. I install the lastest versions. "@cornerstonejs/core": "^1.66.6", "@cornerstonejs/dicom-image-loader": "^1.66.6", "@cornerstonejs/streaming-image-volume-loader": "^1.66.6", "@cornerstonejs/tools": "^1.66.6", All the packages are correctly installed inside the node_modules, or seems to be.

Steps to Reproduce

  1. Setup your new angular 17 project
  2. add with npm or yarn, cornerstone
  3. then cornerstone dicom image loader
  4. import cornerstoneDICOMImageLoader from '@cornerstonejs/dicom-image-loader'; inside a ts file of a component

The current behavior

Could not find a declaration file for module '@cornerstonejs/dicom-image-loader'. 'c:/Users/user/testAppCornerstone3D/node_modules/@cornerstonejs/dicom-image-loader/dist/cornerstoneDICOMImageLoader.bundle.min.js' implicitly has an 'any' type. Try npm i --save-dev @types/cornerstonejs__dicom-image-loader if it exists or add a new declaration (.d.ts) file containing declare module '@cornerstonejs/dicom-image-loader';ts(7016)

The expected behavior

to be able to import @cornerstonejs/dicom-image-loader

OS

Windows 10

Node version

v20.11.1

Browser

Firefox 123.0.1

ArnaudAgixis avatar Mar 15 '24 16:03 ArnaudAgixis

I'm using angular 17 like you and i can import this library like this. image and add cornerstone config in services file without any error image

RadteamBaoDA avatar Mar 20 '24 06:03 RadteamBaoDA

it is odd, search in the cornerstone github, there are some discussions for related issues in vite

sedghi avatar Mar 20 '24 16:03 sedghi

I have tried your solution and still have the problem

ArnaudAgixis avatar Mar 21 '24 15:03 ArnaudAgixis

try copying the cornerstoneDICOMImageLoader.bundle.min.js found in node_modules/@cornerstonejs/dicom-image-loader/dist , to the path src/assets, then including it in the project's index.html

tonitomystery avatar Mar 25 '24 12:03 tonitomystery