Specta LogoSpecta
RspcTypescript apiTs rspc react

@rspc/react

TypeScript API reference for @rspc/react, version 0.0.6.

Public exports of @rspc/react at version 0.0.6.

This page documents 0.0.6. The documented version is 0.2.2.

Type aliases

Demo

declare type Demo<Operations extends OperationsDef, Type extends keyof OperationsDef, K> = Extract<Operations[Type], {
    key: [
        K
    ] | [
        K,
        any
    ];
}>;

View source ↗

OperationKeyArgs

declare type OperationKeyArgs<Operations extends OperationsDef, Type extends keyof OperationsDef, K extends Operations[Type]["key"][0]> = Extract<Operations[Type], {
    key: [
        K
    ] | [
        K,
        any
    ];
}>["key"][1] extends undefined ? [
    K
] : [
    K,
    Extract<Operations[Type], {
        key: [
            K,
            any
        ];
    }>["key"][1]
];

View source ↗

OperationKeyResult

declare type OperationKeyResult<Operations extends OperationsDef, Type extends keyof OperationsDef, K extends Operations[Type]["key"][0]> = Extract<Operations[Type], {
    key: [
        K
    ] | [
        K,
        any
    ];
}>["key"][1] extends undefined ? [
    K
] : [
    K,
    Extract<Operations[Type], {
        key: [
            K,
            any
        ];
    }>["key"][1]
];

View source ↗

Functions

createReactQueryHooks

declare function createReactQueryHooks<T extends OperationsDef>(): {
    Provider: ({ children, client, queryClient, }: {
        children: ReactElement;
        client: Client<T>;
        queryClient: QueryClient;
    }) => JSX.Element;
    useContext: () => Context<T>;
    useQuery: <K extends T["queries"]["key"][0]>(key: Extract<T["queries"], {
        key: [
            K
        ] | [
            K,
            any
        ];
    }>["key"], options?: UseQueryOptions<Extract<T["queries"], {
        key: [
            K
        ] | [
            K,
            any
        ];
    }>["result"], RSPCError, Extract<T["queries"], {
        key: [
            K
        ] | [
            K,
            any
        ];
    }>["result"], _tanstack_react_query.QueryKey>) => UseQueryResult<Extract<T["queries"], {
        key: [
            K
        ] | [
            K,
            any
        ];
    }>["result"], RSPCError>;
// … truncated, see the source link

View source ↗

On this page