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

Generate TS type definitions from jsdoc #1170

Conversation

stereobooster
Copy link

@stereobooster stereobooster commented Oct 26, 2017

We already use tsc for validation, would be nice to generate type definitions. So far this doesn't work. This is rather proof of concept.

I use for this third-party experimental tool. Maybe there is a way to do this with tsc directly?

TSD-JSDoc] Unable to resolve type name "Object". No type found with that name, defaulting to "any".
[TSD-JSDoc] Unable to resolve memberof for "Helper.isNumber", using memberof "Helper". No such name found.
[TSD-JSDoc] Unable to resolve type name "Object". No type found with that name, defaulting to "any".
puppeteer/node_modules/dts-dom/bin/index.js:269
    throw new Error(err);
    ^

Error: Unknown declaration kind property
    at never (puppeteer/node_modules/dts-dom/bin/index.js:269:11)
    at writeDeclaration (puppeteer/node_modules/dts-dom/bin/index.js:789:28)
    at Object.emit (puppeteer/node_modules/dts-dom/bin/index.js:277:5)
    at Emitter.emit (puppeteer/node_modules/tsd-jsdoc/Emitter.js:65:24)
    at Object.publish (puppeteer/node_modules/tsd-jsdoc/publish.js:25:39)
    at Object.module.exports.cli.generateDocs (puppeteer/node_modules/jsdoc/cli.js:448:35)
    at Object.module.exports.cli.processParseResults (puppeteer/node_modules/jsdoc/cli.js:399:20)
    at module.exports.cli.main (puppeteer/node_modules/jsdoc/cli.js:240:14)
    at Object.module.exports.cli.runCommand (/puppeteer/node_modules/jsdoc/cli.js:189:5)
    at puppeteer/node_modules/jsdoc/jsdoc.js:105:9
    at Object.<anonymous> (puppeteer/node_modules/jsdoc/jsdoc.js:106:3)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
error Command failed with exit code 1.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@stereobooster
Copy link
Author

cc @marvinhagemeister

@googlebot
Copy link

CLAs look good, thanks!

@marvinhagemeister
Copy link
Contributor

@stereobooster tsc can only generate *.d.ts files if the source is written in TypeScript (set declaration: true). Other tools I've tried so far were either half complete our out of date regarding the typescript version they built upon. I'm really interested in where you can easily transform the original ast and write out whatever you want. While one can wrap the ts compiler itself, the api for that is rather clunky in my opinion.

@aslushnikov
Copy link
Contributor

Hey @stereobooster, what's the plan for the PR? Do you plan to work on it, or can we close it and revisit later when typescript's issue will be fixed?

@stereobooster
Copy link
Author

I want to work on it, but I suppose main work will be done outside of this PR - in TS or 3rd party lib.

@stereobooster
Copy link
Author

blocking issue microsoft/TypeScript#7546

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

Successfully merging this pull request may close these issues.

None yet

4 participants