cornerstone3D
cornerstone3D copied to clipboard
[Bug] Could not find a declaration file for module '@cornerstonejs/dicom-image-loader' in Angular 17
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
- Setup your new angular 17 project
- add with npm or yarn, cornerstone
- then cornerstone dicom image loader
- 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
I'm using angular 17 like you and i can import this library like this.
and add cornerstone config in services file without any error
it is odd, search in the cornerstone github, there are some discussions for related issues in vite
I have tried your solution and still have the problem
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