You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Rust is a strongly typed language, it seems sensible to check types in HTML attribute values as well. Currently, rsx macro allows the following usage:
Forcing developers to use strongly typed HTML might not be a good idea. However, this feature could still be beneficial for some. I propose two options:
We could issue compiler warnings instead of errors for type mismatches.
We could introduce a configuration option in Dioxus.toml, such as typed_rsx = true, which would make the rsx macro emit errors if there are type mismatches in attribute values.
I’m also considering whether it would be a good idea to define enums for types like InputType, etc.
Another consideration is that traditionally, HTML attributes always accept strings:
Feature Request
Since Rust is a strongly typed language, it seems sensible to check types in HTML attribute values as well. Currently,
rsx
macro allows the following usage:However, the
maxlength
attribute should actually be an integer:Implement Suggestion
Forcing developers to use strongly typed HTML might not be a good idea. However, this feature could still be beneficial for some. I propose two options:
typed_rsx = true
, which would make thersx
macro emit errors if there are type mismatches in attribute values.I’m also considering whether it would be a good idea to define enums for types like InputType, etc.
Another consideration is that traditionally, HTML attributes always accept strings:
While I am still not sure whether this is a good idea, I would like to get opinions about this feature request.
The text was updated successfully, but these errors were encountered: