import { ErrorTypes } from '@rest-hooks/core'; import { Schema, Denormalize, DenormalizeNullable, EndpointInterface, FetchFunction } from '@rest-hooks/react'; import { ParamsFromShape, ReadShape } from './endpoint/index.js'; type CondNull
= P extends null ? A : B;
type StatefulReturn = CondNull
;
loading: false;
error: undefined;
}, {
data: Denormalize;
loading: false;
error: undefined;
} | {
data: DenormalizeNullable;
loading: true;
error: undefined;
} | {
data: DenormalizeNullable;
loading: false;
error: ErrorTypes;
}>;
/**
* Ensure a resource is available; loading and error returned explicitly.
* @see https://resthooks.io/docs/guides/no-suspense
*/
export default function useStatefulResource