I am trying to create a guard that ensures each entry in an array of loaders, which can be either query or proxy, is in the "success" state. Here is my attempted solution:
type LoadedQueryResult = Extract<UseQueryResult, { status: 'success' }>;
type LoadedProxyResult = Extract<UseProxyResult, { status: 'success' }>;
function isLoaded<T extends Array<UseQueryResult | UseProxyResult>>(loaders):
loaders is Array<LoadedQueryResult | LoadedProxyResult>
{
return loaders.every(loader => loader.status === 'success')
}
However, I am encountering issues with this approach. Can guards be utilized with mixed array types?