Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeScript definitions. #636

Open
treytomes opened this issue May 10, 2024 · 1 comment
Open

Fix TypeScript definitions. #636

treytomes opened this issue May 10, 2024 · 1 comment

Comments

@treytomes
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch image-js@0.35.5 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/image-js/index.d.ts b/node_modules/image-js/index.d.ts
index 78bfcb0..304c5a8 100644
--- a/node_modules/image-js/index.d.ts
+++ b/node_modules/image-js/index.d.ts
@@ -7,6 +7,9 @@ import Matrix from 'ml-matrix';
 // Global variable exposed by UMD bundle
 export as namespace IJS;
 
+// TODO: Had to add this one to satify the type checker.
+export type RoiManagerOptions = any | {};
+
 export declare class Image {
   width: number;
   height: number;
@@ -408,22 +411,18 @@ export declare class Roi {
   getMask(options?: {
     scale?: number;
     kind?:
-      | 'contour'
-      | 'box'
-      | 'filled'
-      | 'center'
-      | 'mbr'
-      | 'hull'
-      | 'hullContour'
-      | 'mbrContour'
-      | 'feret'
-      | 'normal';
+    | 'contour'
+    | 'box'
+    | 'filled'
+    | 'center'
+    | 'mbr'
+    | 'hull'
+    | 'hullContour'
+    | 'mbrContour'
+    | 'feret'
+    | 'normal';
   }): Image;
 
-  get height(): number;
-  get width(): number;
-  get center(): [number, number];
-  get ratio(): number;
   get center(): [number, number];
   get ratio(): number;
   get width(): number;
@@ -431,7 +430,6 @@ export declare class Roi {
   get externalIDs(): number[];
   get externalLengths(): number[];
   get borderIDs(): number[];
-  get borderIDs(): number[];
   get borderLengths(): number[];
   get boxIDs(): number[];
   get internalIDs(): number[];
@@ -555,10 +553,6 @@ export class RoiManager {
   getAnalysisMasks(options?: { analysisProperty: string }): Image[];
   getData(options?: Record<string, any>): number[];
   paint(options?: {
-    labelProperty?: string;
-    analysisProperty?: string;
-    analysisProperty?: string;
-    labelProperty?: string;
     analysisProperty?: string;
     labelProperty?: string;
     pixelSize?: number;

This issue body was partially generated by patch-package.

@treytomes
Copy link
Author

I'm using image-js to load server-side assets for an Electron-based game engine I'm building. Thank you for your continued work on this project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant