-
-
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
Typescript declaration files script #7465
base: dev-2.0
Are you sure you want to change the base?
Conversation
0f35005
to
16149c1
Compare
2face78
to
35cb018
Compare
I think this still needs work, the format of the output files, and cases to be handled. But, @davepagurek Do you think this would be the correct approach to bypass |
I think that's probably the best way forward, since it seemed pretty hard to get tsc to understand how we're adding to p5 classes dynamically. Looking good so far! |
function generateTypeFromTag(param) { | ||
if (!param || !param.type) return 'any'; | ||
|
||
switch (param.type.type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more complex case you might want to try with is paletteLerp
, which has an array of tuples:
p5.js/src/color/creating_reading.js
Lines 1090 to 1091 in c643b7b
* @method paletteLerp | |
* @param {[p5.Color, Number][]} colors_stops color stops to interpolate from |
Ideally that out output basically back out to its original format, or possibly Array<[p5.Color, number]>
19c5fba
to
35cb018
Compare
Hi @asukaminato0721, I also wanted to get your feedback on this! The approach, I think, will end up being pretty similar to p5.ts where we aren't directly running In the p5.ts implementation, there are also some manual patches that get applied in addition to generating things directly from the docs: https://github.com/p5-types/p5.ts/tree/master/patches @diyaayay we should see if we can update this in p5 itself too if we can. |
Sure, I'll look into all the patches and see how many of these are still applicable on the |
This looks promise! I like it. |
This is based off of #6777 and #6972. WIP.
Maybe an AST based approach could be added to the current script. This still needs to handle a few cases, such as static methods.
Changes:
Screenshots of the change:
PR Checklist
npm run lint
passes