mljs / distance

Distance functions to compare vectors
https://mljs.github.io/distance/
MIT License
67 stars 4 forks source link

Typescript dependencies are missing #18

Open jjspace opened 4 months ago

jjspace commented 4 months ago

cheminfo-types and ml-tree-similarity are not dev dependencies when using this (or a package that uses this like LangChain) within a Typescript project.

node_modules/ml-distance/lib/similarities/tanimoto.d.ts:1:29 - error TS2307: Cannot find module 'cheminfo-types' or its corresponding type declarations.

1 import { NumberArray } from 'cheminfo-types';            

node_modules/ml-distance/lib/similarities.d.ts:1:23 - error TS7016: Could not find a declaration file for module 'ml-tree-similarity'. '[path]/node_modules/ml-distance/node_modules/ml-tree-similarity/lib/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/ml-tree-similarity` if it exists or add a new declaration (.d.ts) file containing `declare module 'ml-tree-similarity';`

1 import * as tree from 'ml-tree-similarity';                                        

Reproduce

The same happens for ml-tree-similarty when in a project that references lib/similarity.d.ts because it's generated without the expect error comment. I think the types should be fully passed through but if you don't intend them to you need to make sure the errors don't propagate.

songzhenqi commented 1 week ago

Same problem here.

I Just set "skipLibCheck": true in tsconfig.json

can bypass the d.ts checking