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

Auto-generated API docs seem not to be using TypeScript files #496

Closed
MysteryBlokHed opened this issue Mar 22, 2024 · 6 comments · Fixed by #497
Closed

Auto-generated API docs seem not to be using TypeScript files #496

MysteryBlokHed opened this issue Mar 22, 2024 · 6 comments · Fixed by #497

Comments

@MysteryBlokHed
Copy link
Member

If you look at the new API page (https://colorjs.io/api/), many variables and parameters just have any as their types. It looks to me like TypeDoc is pointed at the wrong files (i.e. the JS source instead of .d.ts files).

Here's the page for the Color class, for example: https://colorjs.io/api/classes/color.color

A screenshot of part of the aforementioned link, showing that many properties have their types documented as "any."

@LeaVerou
Copy link
Member

Saw this after reviewing the PR. Yikes! Thanks @MysteryBlokHed for the PR!

@jgerigmeyer
Copy link
Member

@MysteryBlokHed So to be clear, what are the JSDoc comments in the src/ files being used for? There's a lot of duplication currently between those comments and the comments in types/.

@MysteryBlokHed
Copy link
Member Author

@MysteryBlokHed So to be clear, what are the JSDoc comments in the src/ files being used for? There's a lot of duplication currently between those comments and the comments in types/.

At the moment, I don't think they do anything other than maybe provide IntelliSense while working on the library itself.

I'd be for removing JSDoc from the JavaScript files personally, to avoid confusion for contributors as to where docs come from. Anything that’s currently documented there is probably from before the TypeScript types were added.

@LeaVerou
Copy link
Member

Oof, but having the comments in a completely different place instead of when working on the actual source is also very suboptimal. Is there any way to merge the two for typedoc, so we don't have to duplicate them and they can still live together with their definitions?

If not, it may be time to move to TypeScript. :/

@MysteryBlokHed
Copy link
Member Author

Something might be possible with the @inheritdoc JSDoc directive? Maybe it can be used to point to docs from files in some way. But other than that, I don't think there would be any way to use docs from the JS and types from the TS.

Even on DefinitelyTyped (Microsoft's repository for library typings), documentation is just manually copied from the source libraries.

@LeaVerou
Copy link
Member

I just opened this to discuss: #499

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 a pull request may close this issue.

3 participants