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

Add a compiler define for forcing boolean attributes to be required #97

Open
gene-pavlovsky opened this issue Sep 11, 2023 · 0 comments

Comments

@gene-pavlovsky
Copy link

Multiple times we've run into issues when some boolean attribute is added to a view, then we forget to pass it, the code compiles, but the attribute is false by default.
While this can be useful for some simple HTML-like attributes, like disabled, this leads to hard-to-catch bugs.
Proposal: add a compiler define that forces boolean attributes to be required, just like any other ones.
For attributes like HTML's disabled, the developed can explicitly state
@:attribute var disabled:Boolean = @byDefault false;
Perhaps this could also be equivalent:
@:optional @:attribute var disabled:Boolean;

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

1 participant