webex/webex-js-sdk

TypeScript Support

sgtoj opened this issue · 6 comments

sgtoj commented

Please include a TypeScript generated declaration file with the npm package.

Thanks for your feedback! We are planning on adding this soon!

Any updtes on this?

@next-franciscocalle, no updates. This was just before the pandemic hit and since, our priorities have changed. No ETA on this.

Would anyone mind if I created a @types/webex-js-sdk (DefinitelyTyped) package based on the types found in docs? Or has someone already started this work?

I've got some typings I worked on for a bot and would like to share them.

Although after looking through the source, it looks like there are lots of js comments for all the methods. Is it possible to generate typescript declaration files from this?

Edit:
It seems that npx -p typescript tsc packages/node_modules/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types can generate type declaration files. Not sure how this works with es6 importing but I will be investigating this a bit.

Although after looking through the source, it looks like there are lots of js comments for all the methods. Is it possible to generate typescript declaration files from this?

Edit: It seems that npx -p typescript tsc packages/node_modules/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types can generate type declaration files. Not sure how this works with es6 importing but I will be investigating this a bit.

Were you successful with this approach?