Skip to content

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

@gene-pavlovsky

Description

@gene-pavlovsky

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions