Description
Request
If you have a ReadOnlySignal<bool>
or Signal<bool>
, it can be verbose to use the #[props(default = x)]
syntax. For example:
#[derive(Props, Clone, PartialEq)]
pub struct SomeProps {
// This sets bool to be false
#[props(default)]
value: ReadOnlySignal<bool>,
// This is what I'd like, except it wants a ReadOnlySignal
#[props(default = true)]
value: ReadOnlySignal<bool>,
// Instead you have to do this:
#[props(default = ReadOnlySignal::new(Signal::new(true)))]
value: ReadOnlySignal<bool>,
// Same for signals:
#[props(default = Signal::new(true))]
value: Signal<bool>,
}
Implement Suggestion
Detect if the prop type is a ReadOnlySignal
or Signal
and automatically create boilerplate code, injecting the provided expression as the input to the ::new
functions.