-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
2.0: Add Typescript type exporting #6972
base: dev-2.0
Are you sure you want to change the base?
Conversation
TODO: make a thing to generate global mode types |
@davepagurek Just trying this and found a rather significant roadblock. The generated I'm trying to find ways to work around it but couldn't find any so far. It would be great if there is a way to generate directly from JSDoc only and for |
Manually generating the .d.ts format from Documentation.js and bypassing |
@davepagurek Do you think it is worth writing this conversion or a conversion that goes directly from Documentation.js to zod for FES would be a better approach? Also I have less than perfect confidence in the longevity of Documentation.js as a project, we don't need to review things now especially we have a working Documentation.js -> YUIDoc converter, but to consider a bit of future proofing, would anything change in this case? |
For FES probably Documentation.js output to Zod is easiest? I talked to @sproutleaf some more about it this week and that seems like maybe the easiest way forward. If in the future we also add .d.ts generation, if we do that from the Documentation.js output too, it's still kind of nice having everything come from the same source, but we aren't blocked on having that. |
Yeah, sounds good. Let's go with that. |
This is based off of #6777, so you can see just the new Typescript bits here: https://github.com/davepagurek/p5.js/compare/initial-conversion-script..tsc
So it adds an
npm run types
command which generates, currently,types/p5.rollup.esm.d.ts
. The reason for the name is that:exports
, solib/p5.rollup.js
doesn't output any types, butlib/p5.rollup.esm.js
does.