@refinedev/core
Version:
Refine is a React meta-framework for building enterprise-level, data-intensive applications rapidly with support for modern UI libraries and headless integrations.
34 lines • 1.23 kB
Source Map (JSON)
import type { IResourceItem } from "../../../contexts/resource/types";
/**
* Matches the resource by identifier.
* If not provided, the resource from the route will be returned.
* If your resource does not explicitly define an identifier, the resource name will be used.
*/
export type UseResourceParam = string | undefined;
export type SelectReturnType<T extends boolean> = T extends true ? {
resource: IResourceItem;
identifier: string;
} : {
resource: IResourceItem;
identifier: string;
} | undefined;
export type UseResourceReturnType = {
resources: IResourceItem[];
resource?: IResourceItem;
select: <T extends boolean = true>(resourceName: string, force?: T) => SelectReturnType<T>;
identifier?: string;
};
type UseResourceReturnTypeWithResource = UseResourceReturnType & {
resource: IResourceItem;
identifier: string;
};
/**
* @internal
*/
export declare function useResource(): UseResourceReturnType;
/**
* @internal
*/
export declare function useResource<TIdentifier = UseResourceParam>(identifier: TIdentifier): TIdentifier extends NonNullable<UseResourceParam> ? UseResourceReturnTypeWithResource : UseResourceReturnType;
export {};
//# sourceMappingURL=index.d.ts.map