UNPKG

@connectrpc/connect-query

Version:

TypeScript-first expansion pack for TanStack Query that gives you Protobuf superpowers.

27 lines 1.33 kB
import type { Message, PartialMessage } from "@bufbuild/protobuf"; import type { MethodUnaryDescriptor } from "./method-unary-descriptor.js"; /** * Pass this value as an input to signal that you want to disable the query. */ export declare const disableQuery: unique symbol; /** * Use this type in situations where you want to disable a query from use. */ export type DisableQuery = typeof disableQuery; /** * Throws an error with the provided message when the condition is `false` */ export declare function assert(condition: boolean, message: string): asserts condition; /** * Verifies that the provided input is a valid AbortController */ export declare const isAbortController: (input: unknown) => input is AbortController; /** * @see `Updater` from `@tanstack/react-query` */ export type ConnectUpdater<O extends Message<O>> = PartialMessage<O> | ((prev?: O) => PartialMessage<O> | undefined); /** * This helper makes sure that the Class for the original data is returned, even if what's provided is a partial message or a plain JavaScript object representing the underlying values. */ export declare const createProtobufSafeUpdater: <I extends Message<I>, O extends Message<O>>(methodSig: Pick<MethodUnaryDescriptor<I, O>, "O">, updater: ConnectUpdater<O>) => (prev?: O) => O; //# sourceMappingURL=utils.d.ts.map