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

Add JSDoc for Box2 #29357

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft

Add JSDoc for Box2 #29357

wants to merge 2 commits into from

Conversation

Methuselah96
Copy link
Contributor

@Methuselah96 Methuselah96 commented Sep 8, 2024

Related issue: #24984 (comment)

Description

A proof-of-concept for adding JSDoc (the .d.ts file is built by running npm run build-types, it wouldn't actually be committed if we go with this approach)

Copy link

github-actions bot commented Sep 8, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 685.24
169.64
685.24
169.64
+0 B
+0 B
WebGPU 826.2
221.55
826.2
221.55
+0 B
+0 B
WebGPU Nodes 825.78
221.46
825.78
221.46
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 462.02
111.48
462.02
111.48
+0 B
+0 B
WebGPU 525.3
141.56
525.3
141.56
+0 B
+0 B
WebGPU Nodes 481.95
131.37
481.95
131.37
+0 B
+0 B

@mrdoob
Copy link
Owner

mrdoob commented Sep 12, 2024

I think as long as we do not force contributors to have to write these I think it may be okay.

But I'm afraid we'll end up having discussions about types in the repo again and that would slow us down.

Are you trying to look for ways to offload the maintenance of types?

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 12, 2024

I would expect we primarily write JSDoc to generate the English API documentation. It is a nice side effect that we can also use JSDoc to generate TS declaration files. However, the actual generation and hosting/providing should be done in a different repository and npm package (three-ts-types).

In this way, discussions about the TS related topics happen at a different place. We can accept PRs to improve the typings in the scope of JSDoc.

@Methuselah96
Copy link
Contributor Author

Methuselah96 commented Sep 12, 2024

@Mugen87 is exactly right. The goal is also to make maintenance of the translated docs easier. Making it easier to create TS declaration files is not a goal, it's just a nice side-effect, so any discussion of TS types should still happen in three-ts-types.

The other option that has been discussed would be to host the types and the documentation in a different repo together (.d.ts+TSDoc), but I think this is the better split so you can ignore TypeScript altogether, just mentioning it in case you find that appealing.

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.

3 participants