samuelho
samuelho
TTCTheo's Typesafe Cult
Created by samuelho on 4/6/2023 in #questions
TRPC async promise return type
Ahh understood! That actually resolved it for me. Really appreciate you chiming in 🙏 was going in circles
10 replies
TTCTheo's Typesafe Cult
Created by samuelho on 4/6/2023 in #questions
TRPC async promise return type
Yeah I think thats the part where im struggling a little bit . I tried using the
?? []
?? []
but i wasnt able to resolve the error via that. I am trying to check if it has data before it passes the data to the component but im still getting the same results
{pluginDropdownActive && categoriesQuery.data && (
<PluginDropdown categories={categoriesQuery.data ?? []} />
)}
{pluginDropdownActive && categoriesQuery.data && (
<PluginDropdown categories={categoriesQuery.data ?? []} />
)}
Type 'Promise<{ id: number; name: string; subcategories: { id: number; name: string; categoryId: number; }[]; }[]>' is missing the following properties from type 'Category[]': length, pop, push, concat, and 31 more.ts(2740)
Navbar.tsx(23, 3): The expected type comes from property 'categories' which is declared here on type 'IntrinsicAttributes & PluginDropdownProps'
(property) PluginDropdownProps.categories: Category[]
Type 'Promise<{ id: number; name: string; subcategories: { id: number; name: string; categoryId: number; }[]; }[]>' is missing the following properties from type 'Category[]': length, pop, push, concat, and 31 more.ts(2740)
Navbar.tsx(23, 3): The expected type comes from property 'categories' which is declared here on type 'IntrinsicAttributes & PluginDropdownProps'
(property) PluginDropdownProps.categories: Category[]
10 replies