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

Make #prop(into, default) a bit more ergonomic. #2386

Open
gzp79 opened this issue Feb 29, 2024 · 1 comment · May be fixed by #2407
Open

Make #prop(into, default) a bit more ergonomic. #2386

gzp79 opened this issue Feb 29, 2024 · 1 comment · May be fixed by #2407

Comments

@gzp79
Copy link

gzp79 commented Feb 29, 2024

At the momement MaybeSignal and similar component properties can be constructed like this:

#prop(into, default = false.into()) disabled: MaybeSignal<bool>
#prop(into, default = "Some value".into()) disabled: MaybeSignal<String>

While this is working when components with many default props are created, the into() calls on the default creates a lot of noise, boilerplate. So I'd suggest to make the .into() call part of the proc-macro:

#prop(into, default = false) disabled: MaybeSignal<bool>
#prop(into, default = "Some value") disabled: MaybeSignal<String>

I think the extra into when it is not required would be compiled to a no-op.
Also this feature could be enabled only when both the input and default tags are present in the annotation.

@gbj
Copy link
Collaborator

gbj commented Mar 1, 2024

Any interest in making a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants