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

feat: primitive TypeScript support #7

Merged
merged 2 commits into from
Apr 8, 2020

Conversation

buschtoens
Copy link
Contributor

@buschtoens buschtoens commented Nov 21, 2018

This PR enables primitive TypeScript support by:

This solution is not perfect, but good enough to at least enable documenting TypeScript code, until ember-cli-addon-docs-typedoc is or ember-cli-addon-docs-tsdoc are a real thing.

@buschtoens
Copy link
Contributor Author

buschtoens commented Nov 21, 2018

It seems that for TypeScript files all @tags are ignored.

For instance, this yields:

class Foo {
  /**
   * this is method3.
   * @param n - this is the param desc.
   * @return this is the return desc.
   * @private
   */
  private method3(n: number): string {}
}

image

But that would be an upstream issue with esdoc-typescript-plugin, I assume. And I think that this crude documentation is still better than no documentation.

@buschtoens
Copy link
Contributor Author

Aha! esdoc/esdoc-plugins#25

class Foo {
  /**
   * @desc this is method3.
   * @param n - this is the param desc.
   * @return this is the return desc.
   * @private
   */
  private method3(n: number): string {}
}

image

However, this the breaks the type information.

(The @private tag is also not automatically inferred.)

@buschtoens
Copy link
Contributor Author

There also seems to be trouble with Generics<T> and <Type>casts: esdoc/esdoc-plugins#74

@tstormk
Copy link

tstormk commented Jan 11, 2019

Any updates on this? We really need Typescript support for our documentation and it would be great if this addon could support it. Currently there seems to be no work around either.

It would also be great if this addon could support custom ESDoc plugins.

@RobbieTheWagner
Copy link
Member

@buschtoens @tstormk do either of you know if enabling the TS plugin effects normal JS output from ESDoc at all? This looks fine to me, but I would like to double check we are not messing anything up for JS users.

@@ -25,7 +26,8 @@ const ESDOC_CONFIG = {
dynamicImport: true
}
},
{ name: 'esdoc-accessor-plugin' }
{ name: 'esdoc-accessor-plugin' },
{ name: 'esdoc-typescript-plugin', option: { enable: true } }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ name: 'esdoc-typescript-plugin', option: { enable: true } }
{ name: 'esdoc-typescript-plugin' }

this enable option is true by default.

@nightire
Copy link

nightire commented Apr 4, 2020

Can we cut a release with this improvement? I tested in a fairly large project which migrates some .js to .ts, and this PR works pretty well.

@RobbieTheWagner
Copy link
Member

@nightire I mainly wanted to make sure it did not break plain JS. Does it work well for both vanilla JS and TS for you?

@nightire
Copy link

nightire commented Apr 8, 2020

@rwwagner90 Yes, it works well for both vanilla JavaScript and TypeScript.

@RobbieTheWagner RobbieTheWagner merged commit 6840182 into ember-learn:master Apr 8, 2020
@RobbieTheWagner RobbieTheWagner added the enhancement New feature or request label Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants