imgly / background-removal-js

Remove backgrounds from images directly in the browser environment with ease and no additional costs or privacy concerns. Explore an interactive demo.
https://img.ly/showcases/cesdk/web/background-removal/web
GNU Affero General Public License v3.0
5.49k stars 339 forks source link

fix: add ndarray types #102

Closed mirko314 closed 4 months ago

mirko314 commented 5 months ago

This PR adds types for the ndarray library to the node and web package.

I've run into the following error when using the package and this should hopefully fix the error when compiling typescript:

../../node_modules/@imgly/background-removal/dist/codecs.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'ndarray'. '/.../node_modules/ndarray/ndarray.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/ndarray` if it exists or add a new declaration (.d.ts) file containing `declare module 'ndarray';`

2 import { NdArray } from 'ndarray';
                          ~~~~~~~~~

../../node_modules/@imgly/background-removal/dist/utils.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'ndarray'. '/.../node_modules/ndarray/ndarray.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/ndarray` if it exists or add a new declaration (.d.ts) file containing `declare module 'ndarray';`

2 import { NdArray } from 'ndarray';
                          ~~~~~~~~~

Found 2 errors in 2 files.

Errors  Files
     1  ../../node_modules/@imgly/background-removal/dist/codecs.d.ts:2
     1  ../../node_modules/@imgly/background-removal/dist/utils.d.ts:2
error Command failed with exit code 2.