Open danielchalmers opened 6 months ago
@danielchalmers thanks for contacting us.
I don't think there's a way to do it other than anotating the T in the @typeparam
which I don't remember if it's possible. This will likely require compiler work to support it.
Looks like the type inference would need to explicitly set the type param in the presence of CascadingTypeParam
__builder.OpenComponent<global::BlazorApp42.Components.Pages.MudToggleGroup<int?>>(5);
__builder.AddAttribute(6, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
global::__Blazor.BlazorApp42.Components.Pages.Home.TypeInference.CreateMudToggleItem_0<int?>(__builder2, 7, 8, // <!-- THIS. Today we don't emit <int?> so can't infer the type. We would need to explicitly add it as a type param in this case.
#nullable restore
#line (10,27)-(10,31) "C:\Projects\scratch\BlazorApp42\BlazorApp42\Components\Pages\Home.razor"
null
#line default
#line hidden
#nullable disable
, 9, "Coffee (1)");
__builder2.AddMarkupContent(10, "\r\n ");
global::__Blazor.BlazorApp42.Components.Pages.Home.TypeInference.CreateMudToggleItem_1(__builder2, 11, 12,
#nullable restore
#line (11,27)-(11,28) "C:\Projects\scratch\BlazorApp42\BlazorApp42\Components\Pages\Home.razor"
2
#line default
#line hidden
#nullable disable
, 13, "Tee (2)");
__builder2.AddMarkupContent(14, "\r\n ");
global::__Blazor.BlazorApp42.Components.Pages.Home.TypeInference.CreateMudToggleItem_2(__builder2, 15, 16,
#nullable restore
#line (12,27)-(12,28) "C:\Projects\scratch\BlazorApp42\BlazorApp42\Components\Pages\Home.razor"
3
#line default
#line hidden
#nullable disable
, 17, "Water (3)");
}
));
__builder.CloseComponent();
Discussed in https://github.com/dotnet/aspnetcore/discussions/54332