Open namnm opened 3 years ago
Absolutely @namnm! A PR is welcome 🙂
We already have the jsdoc type system, I think we can use a tool to automatically convert the jsdoc to typescript declaration. Something like: https://github.com/brettle/jsdoc-to-typescript-declaration
@namnm Hi! You can look here and help to translate the old code to the typescript, to refuse declarations. I'm working on it but haven't get much time :cry: https://github.com/agsh/onvif/tree/v1/src
I've tried to generate types from the js files with tsc, but I'm having problem with parsing the cam.js file.
npx -p typescript tsc lib/cam.js --declaration --allowJs --emitDeclarationOnly --outDir types
give the error:
TS9005: Declaration emit for this file requires using private name 'Cam'. An explicit type annotation may unblock declaration emit.
It seems that It can not determine the type of Cam, or that it is not exported correctly?
@grreb Oh! This is easy :smile: I've already prepared a PR to fix this. You can check that everything is ok and write here if no.
Hi, thanks for this great library. We can add TypeScript declaration to have the type safety cover.