TanStack
API Reference

BaseQueryNarrowing

Defined in: packages/angular-query/src/types.ts:85

Signal-backed guards that narrow a query result and its data and error fields by status: the isSuccess/isError/isPending methods on a query result. Unlike react-query's derived booleans, each is a Signal you call to read its current boolean value reactively, and the call is also a type guard — if (query.isSuccess()) — so that query.data narrows away undefined inside the branch, the same way status narrowing works on the plain object react-query returns.

Type Parameters

TData

TData = unknown

The type data ends up as after select runs.

TError

TError = DefaultError

The type of errors your queryFn may throw.

Properties

PropertyTypeDescription
isErrorSignalFunction<() => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"error", TData, TError>>>Returns whether the result failed and narrows its data and error signals.
isPendingSignalFunction<() => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"pending", TData, TError>>>Narrows the result to the pending state when that state is possible.
isSuccessSignalFunction<() => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"success", TData, TError>>>Returns whether the result is successful and narrows its data and error signals.