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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript dependencies are missing #18

Open
jjspace opened this issue Jun 12, 2024 · 1 comment
Open

Typescript dependencies are missing #18

jjspace opened this issue Jun 12, 2024 · 1 comment

Comments

@jjspace
Copy link

jjspace commented Jun 12, 2024

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

  • create a new test directory
  • run npm init -y
  • run npm install ml-distance typescript
  • create an index.ts file with the import import { distance, similarity } from 'ml-distance';
  • run npx tsc index.ts
  • observe errors
  • run npm install cheminfo-types
  • run npx tsc index.ts again
  • observe errors are gone

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
Copy link

Same problem here.

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

can bypass the d.ts checking

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

2 participants