diff --git a/packages/yew-macro/src/function_component.rs b/packages/yew-macro/src/function_component.rs
index e21893b35b4..f05ed2b2428 100644
--- a/packages/yew-macro/src/function_component.rs
+++ b/packages/yew-macro/src/function_component.rs
@@ -201,7 +201,7 @@ pub fn function_component_impl(
#[doc(hidden)]
#[allow(non_camel_case_types)]
#[allow(unused_parens)]
- #vis struct #function_name #impl_generics {
+ #vis struct #function_name #generics {
_marker: ::std::marker::PhantomData<(#phantom_generics)>,
}
@@ -215,7 +215,7 @@ pub fn function_component_impl(
#(#attrs)*
#[allow(type_alias_bounds)]
- #vis type #component_name #impl_generics = ::yew::functional::FunctionComponent<#function_name #ty_generics>;
+ #vis type #component_name #generics = ::yew::functional::FunctionComponent<#function_name #ty_generics>;
};
Ok(quoted)
diff --git a/packages/yew-macro/tests/function_component_attr/with-defaulted-type-param-pass.rs b/packages/yew-macro/tests/function_component_attr/with-defaulted-type-param-pass.rs
new file mode 100644
index 00000000000..9ff37a91496
--- /dev/null
+++ b/packages/yew-macro/tests/function_component_attr/with-defaulted-type-param-pass.rs
@@ -0,0 +1,25 @@
+use yew::prelude::*;
+
+#[derive(Properties, Debug)]
+pub struct CompProps {
+ #[prop_or_default]
+ _phantom: std::marker::PhantomData,
+}
+
+impl PartialEq for CompProps {
+ fn eq(&self, _rhs: &Self) -> bool {
+ true
+ }
+}
+
+#[function_component(Comp)]
+pub fn comp(_props: &CompProps) -> Html {
+ todo!()
+}
+
+#[function_component(App)]
+pub fn app() -> Html {
+ html! { } // No generics here.
+}
+
+fn main() {}