oceanprotocol / ocean.js

🦑 Ocean Protocol JavaScript library to privately & securely publish, exchange, and consume data.
https://docs.oceanprotocol.com/references/ocean.js/
Apache License 2.0
106 stars 67 forks source link

Add a type declaration file #1850

Open jamiehewitt15 opened 1 month ago

jamiehewitt15 commented 1 month ago

If you try and use ocean.js from another typescript project in strict mode, you will get this error:

Could not find a declaration file for module '@oceanprotocol/lib'. '/home/jamie/Desktop/ocean/vscode-extension/node_modules/@oceanprotocol/lib/dist/lib.js' implicitly has an 'any' type.

Try `npm i --save-dev @types/oceanprotocol__lib` if it exists or add a new declaration (.d.ts) file containing `declare module '@oceanprotocol/lib';`ts(7016)

We don't have a type declaration file so there there is no easy way round this for developers.

alexcos20 commented 3 weeks ago

current version:

image

old version:

image

But not sure that src/types/... is the correct path

jamiehewitt15 commented 2 weeks ago

yeah, I think it might be an error in the location and also how it's referenced in package.json