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

More type annotations or type documentation please #153

Open
dhasenan opened this issue Nov 19, 2014 · 3 comments
Open

More type annotations or type documentation please #153

dhasenan opened this issue Nov 19, 2014 · 3 comments

Comments

@dhasenan
Copy link
Contributor

It's hard to tell what sort of parameters things take without diving into the code -- and not just looking at the source of the function I'm calling. I just got an exception inside CanvasRenderer.createPattern complaining that it received the wrong type or number of arguments. The stack trace is somewhere in the middle of CanvasRenderer.render() and probably indicates that I gave the wrong type of value to a texture or material constructor -- somewhere far away from any function in the stack trace.

Providing more type annotations where possible would help me catch these errors before I even finish typing them.

@dhasenan
Copy link
Contributor Author

Actually, this exception that I got looks like it might actually be a different bug: CanvasRenderingContext2D says that createPattern takse a canvas_OR_image but it actually takes a CanvasElement or VideoElement. Still, more type annotations would be nice.

@johsin18
Copy link
Contributor

johsin18 commented Dec 7, 2014

I also vote for more type annotations, at least as recommended here:
https://www.dartlang.org/articles/style-guide/#type-annotations
However, this is probably a legacy from porting from JavaScript.

@beatgammit
Copy link
Contributor

I did a lot of this in #165, but there's still quite a bit to do.

Once #166 is resolved, I'd like to do another documentation pass and create a list of functions/types that still need documentation for things I can't figure out.

The style guide recommends adding type annotations for method signatures and omitting them for local variables (unless the function is long). There's an upstream issue for automating checking for missing annotations, but for now it's a manual process.

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

No branches or pull requests

3 participants