cornerstonejs / cornerstone3D

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
https://cornerstonejs.org
MIT License
528 stars 271 forks source link

[Bug] There are no type definition files in DicomImageLoader Module build #750

Open TardigradeX opened 1 year ago

TardigradeX commented 1 year ago

Describe the Bug

Trying to use:

import cornerstoneDICOMImageLoader from '@cornerstonejs/dicom-image-loader'

does lead to: Could not find a declaration file for module '@cornerstonejs/dicom-image-loader'

If you look at node_modules/@cornerstonejs/dicom-image-loader there are no d.ts files to be found. You can also see the following in the package.json file.

 "scripts": {
    "build:umd:dynamic": "cross-env NODE_ENV=production webpack --config .webpack/webpack-dynamic-import.js",
    "build:umd:bundle": "cross-env NODE_ENV=production webpack --config .webpack/webpack-bundle.js",
    "build:all": "yarn run build:umd:dynamic & yarn run build:umd:bundle",
    "copy-dts": "echo 'not implemented yet'",
...

It seems that the type definition files are never added to the distributed build file.

Steps to Reproduce

  1. First add loader to the project:yarn add @cornerstonejs/dicom-image-loader
  2. Then try to import it: import cornerstoneDICOMImageLoader from '@cornerstonejs/dicom-image-loader'

The current behavior

Could not find a declaration file for module '@cornerstonejs/dicom-image-loader'

The expected behavior

It should find declaration files.

OS

Windows 10

Node version

16.20.0

Browser

Chrome 116.0.5845.97

sedghi commented 10 months ago

We had some issues publishing the esm version of dicom image loader because of the webworkers and wasm modules that we use. I will re-visit this

jsibrel commented 2 months ago

Was there ever a solution for this or a work around?

sedghi commented 2 months ago

The beta branch has types I'm working to puah it to main and 2.xx version in the coming days

sedghi commented 2 months ago

if you use 2.0.0-beta.17 they have types