Specta LogoSpecta
RspcTypescript apiTs rspc solid

@rspc/solid

TypeScript API reference for @rspc/solid, version 0.0.0-main-b8b35d28.

Public exports of @rspc/solid at version 0.0.0-main-b8b35d28.

This page documents 0.0.0-main-b8b35d28. The documented version is 0.2.0.

Interfaces

BaseOptions

export interface BaseOptions<TProcedures extends ProceduresDef> {
    rspc?: {
        client?: Client<TProcedures>;
    };
}

View source ↗

Context

export interface Context<TProcedures extends ProceduresDef> {
    client: Client<TProcedures>;
    queryClient: QueryClient;
}

View source ↗

SubscriptionOptions

export interface SubscriptionOptions<TOutput> {
    enabled?: boolean;
    onStarted?: () => void;
    onData: (data: TOutput) => void;
    onError?: (err: RSPCError) => void;
}

View source ↗

Type aliases

HooksOpts

export type HooksOpts<P extends ProceduresDef> = {
    context: Solid.Context<Context<P>>;
};

View source ↗

KeyAndInput

export type KeyAndInput = [
    string
] | [
    string,
    any
];

View source ↗

Functions

createReactQueryHooks

export declare function createReactQueryHooks<P extends ProceduresDef>(client: AlphaClient<P>, opts?: HooksOpts<P>): {
    _rspc_def: P;
    Provider: (props: {
        children?: Solid.JSX.Element;
        client: AlphaClient<P>;
        queryClient: QueryClient;
    }) => Solid.JSX.Element;
    useContext: () => Context<P>;
    createQuery: <K extends P["queries"]["key"] & string, TQueryFnData = inferQueryResult<P, K>, TData = inferQueryResult<P, K>>(keyAndInput: () => [
        key: K,
        ...input: _inferProcedureHandlerInput<P, "queries", K>
    ], opts?: Omit<CreateQueryOptions<TQueryFnData, AlphaRSPCError, TData, () => [
        K,
        inferQueryInput<P, K>
    ]>, "queryFn" | "queryKey"> & BaseOptions<P>) => CreateQueryResult<TData, RSPCError>;
    createMutation: <K_1 extends P["mutations"]["key"] & string, TContext = unknown>(key: K_1 | [
        K_1
// … truncated, see the source link

View source ↗

On this page