How to make LoaderAndError component which is type safe?
I i have a query like this
const { data, isLoading, isError } = trpc.settings.get.useQuery();
Now I have a LoaderAndErrorComponent like below
Now when i am wrapping this LoaderAndError component around a Component and trying to access the data in Component the type is WhateverDataType | undefined
basically TS doesn't know that the Component won't be reached with undefined data
What is a good way to do this ?0 Replies