Skip to content

Commit

Permalink
Preserve return type
Browse files Browse the repository at this point in the history
  • Loading branch information
cecton committed Nov 5, 2023
1 parent 27427cc commit e64e116
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/autoprops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ impl Autoprops {
_ => None,
})
.collect::<Vec<_>>();
let output = &sig.output;

quote! {
#(#attrs)*
#vis fn #fn_name #impl_generics (#inputs) -> ::yew::Html #where_clause {
#vis fn #fn_name #impl_generics (#inputs) #output #where_clause {
#(#clones)*
#block
}
Expand Down
10 changes: 10 additions & 0 deletions tests/function_component_attr/autoprops-pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ mod private_module {

use private_module::*;

#[::yew_autoprops::autoprops]
#[::yew::function_component]
fn CompHtmlResult() -> ::yew::HtmlResult
{
::std::result::Result::Ok(::yew::html! {
<p></p>
})
}

fn compile_pass() {
let _ = ::yew::html! { <CompUseFnName /> };
let _ = ::yew::html! { <CompNoProperties /> };
Expand All @@ -130,6 +139,7 @@ fn compile_pass() {
let _ = ::yew::html! { <CompGenerics<::std::primitive::bool, ::yew::AttrValue> b=true a="foo" /> };
let _ = ::yew::html! { <ConstGenerics<2> xs={[1_u32, 2_u32]} /> };
let _ = ::yew::html! { <CompPrivateTest b=true /> };
let _ = ::yew::html! { <CompHtmlResult /> };
}

fn main() {}

0 comments on commit e64e116

Please sign in to comment.