fix: document `#[prop(default = ...)]` as in Optional Props (closes #1710) (#1721)

This commit is contained in:
Greg Johnston 2023-09-15 15:16:46 -04:00 committed by GitHub
parent 1db3e9c686
commit afa67726c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -911,7 +911,9 @@ fn generate_component_fn_prop_docs(props: &[Prop]) -> TokenStream {
let required_prop_docs = props
.iter()
.filter(|Prop { prop_opts, .. }| {
!(prop_opts.optional || prop_opts.optional_no_strip)
!(prop_opts.optional
|| prop_opts.optional_no_strip
|| prop_opts.default.is_some())
})
.map(|p| prop_to_doc(p, PropDocStyle::List))
.collect::<TokenStream>();
@ -919,7 +921,9 @@ fn generate_component_fn_prop_docs(props: &[Prop]) -> TokenStream {
let optional_prop_docs = props
.iter()
.filter(|Prop { prop_opts, .. }| {
prop_opts.optional || prop_opts.optional_no_strip
prop_opts.optional
|| prop_opts.optional_no_strip
|| prop_opts.default.is_some()
})
.map(|p| prop_to_doc(p, PropDocStyle::List))
.collect::<TokenStream>();