/ p5.js Public
[WIP] Add experimental type-checker for reference tests #1287
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge.
This is a work-in-progress pull request, please don't merge it yet.
@lmccart: let me know if it's annoying to have a WIP PR lying about here--it's fine if that's the case, I can just move it over to my fork. I thought it might be nice to have it in the p5.js PR list so others can participate.
This is an attempt to use p5's own yuidocs to actively type-check its own examples. This can be beneficial for a number of reasons:
lerpColor()can actually take a
p5.Coloras a first argument--and it's likely that users will want to do this--but it isn't documented, then we should document it. Or if the argument type
Numberis misspelled as
Nimber, we should throw an error at build or test time.
Limitations of this PR:
save(). There's a number of ways we can do this but for now we'll use one of two strategies:
p5.color()can actually take a
p5.Colorinstance as its single argument, and internal p5 methods do this all the time. I'm not entirely sure what the point of this is, and it may be too confusing for beginners to document this in our yuidocs, so I wrote a custom validator for this method that makes it not complain if the first argument is a
Finally, note that this PR is an experiment! It's okay if it ends up being rejected. Hopefully we can learn from its mistakes, at least.