Skip to content

[Bug] Type error in polySeg initialisation #1880

Open
@johnpage-agixis

Description

@johnpage-agixis

Describe the Bug

The instructions for initialising tools with polySeg as described en the README produces a type error.

NB. I have updated cornerstonejs/* to version 3.0.4

Steps to Reproduce

Simple reproduction here: https://github.com/johnpage-agixis/polyseg-bug/blob/main/index.ts

Try to initialise tools with polySeg as described in the migration guide and in the README

import { init } from '@cornerstonejs/tools';
import * as polySeg from '@cornerstonejs/polymorphic-segmentation';

// Initialize Cornerstone Tools with the Polymorphic Segmentation addon
await init({
  addons: {
    polySeg,
  },
});

The current behavior

Type error

Type 'typeof import(".../node_modules/@cornerstonejs/polymorphic-segmentation/dist/esm/index")' is not assignable to type 'PolySegAddOn'.
  Types of property 'canComputeRequestedRepresentation' are incompatible.
    Type '(segmentationId: string, type: typeof SegmentationRepresentations) => boolean' is not assignable to type '(segmentationId: string, representationType: SegmentationRepresentations) => boolean'.
      Types of parameters 'type' and 'representationType' are incompatible.
        Type 'import(".../node_modules/@cornerstonejs/tools/dist/esm/enums/SegmentationRepresentations").default' is not assignable to type 'typeof SegmentationRepresentations'.ts(2322)
config.d.ts(21, 5): The expected type comes from property 'polySeg' which is declared here on type 'AddOns'
(property) polySeg: PolySegAddOn

The expected behavior

No type error

OS

Windows 10

Node version

22.11.0

Browser

N/A

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions