-
Notifications
You must be signed in to change notification settings - Fork 20
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
Replace any/object with more accurate types #31
Comments
any
/object
with more accurate types
Sounds like good suggestions!
Feel free to email me if you want help to get started / bounce ideas. |
Thanks for the reply! In the p5.js YUIDoc, it looks like several Not sure if generic functions can be represented in a valid YUIDoc syntax (which seems to be possible in JSDoc with |
I went ahead and asked whether YUIDoc has a similar feature: yui/yuidoc#452. If not, perhaps we can add some dummy types in p5.js, that are just aliases (if that is supported) of Object (like GenericS, GenericT...)
Best way to see is to go ahead and contribute a pull request! |
OK, tried to suggest: processing/p5.js#4991 |
grep "any\[\]" -r ./types/p5/ gives a lot of results, fix/patch them will improve user experiences. |
any examples? I could make PR for them.
I am doing it lol.
I guess not, yui-doc is legacy now. Unless p5.js change to js-doc or something else. |
(Versions I'm referring to: p5 v1.2.0, @types/p5 v0.9.1)
This won't be easy as the typings are automatically generated and we'll need extra work for specifying more accurate types, but at least it would be worth leaving an issue I think.
Here is a list of things that would be nice to see improved:
Event handler functions
Concrete type for
event
instead ofobject
.(Also the return types should be fixed, but maybe it's p5.js documentation issue)
Something like:
random(choices)
and Array functionsWould be nice if we can use generics instead of
any
.For
random()
, something like:and for array functions:
p5.Element
p5.Element.elt
should beHTMLElement
instead ofany
.This property may be used frequently when playing around with DOM.
Ideally,
p5.Element
might also be declared with generics so that we'll have more accurate types, e.g.canvas.elt: HTMLCanvasElement
.saveFrames()
Personally I haven't used this yet, but we could add the argument type of the callback funciton.
Something like:
Other
any[]
intrim()
and some type convertion functionsany
in callbacks of some webgl functionsobject
types in p5.soundAnd of course there might also be some cases where
any
/object
are still appropriate.The text was updated successfully, but these errors were encountered: