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

Include typedefs in typedocs #1214

Closed
1 task done
benmccann opened this issue Feb 21, 2020 · 3 comments
Closed
1 task done

Include typedefs in typedocs #1214

benmccann opened this issue Feb 21, 2020 · 3 comments
Labels
help wanted Contributions are especially encouraged js This issue relates to better TS-in-JS support

Comments

@benmccann
Copy link

benmccann commented Feb 21, 2020

Problem

We declare some types using typedefs. You can see several examples of methods using this typedef in the same file. Example typedef:
https://github.com/chartjs/Chart.js/blob/0d6c05cca00813b0fb93396ce7b37b637f2e6833/src/core/core.scale.js#L11

However, method parameters in the Typedocs using this typedef appear as any (in this case I'd expect it to appear as Tick).

Suggested Solution

Include typedefs as types in the generated documentation

@Gerrit0 Gerrit0 added the js This issue relates to better TS-in-JS support label Feb 22, 2020
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Feb 22, 2020

Its seems reasonable to me to support this. I think there should be a special case for typedefs of type object/Object to be instead converted as interfaces since they can contain @prop / @property tags to more fully describe the object.

Couple notes when implementing:

  1. These types are implicitly exported, they cannot not be exported.
  2. We should also support @callback

@benmccann
Copy link
Author

I think there should be a special case for typedefs of type object/Object to be instead converted as interfaces since they can contain @prop / @Property tags to more fully describe the object.

That makes sense to me. In fact we had @interface historically, but when we migrated to TypeScript we found that it didn't support that tag, so we added a @typedef and now have both:

https://github.com/chartjs/Chart.js/blob/0d6c05cca00813b0fb93396ce7b37b637f2e6833/src/core/core.plugins.js#L183

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 1, 2021

Well... I took another look at this, and turns out it wasn't nearly as painful to support as I thought! 0.20.6 works with it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions are especially encouraged js This issue relates to better TS-in-JS support
Projects
None yet
Development

No branches or pull requests

2 participants