0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-16 22:50:20 +00:00
query/docs/framework/angular/reference/interfaces/BaseQueryNarrowing.md

1.8 KiB

id title
BaseQueryNarrowing BaseQueryNarrowing

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

The isSuccess/isError/isPending methods on a query result. Unlike react-query's derived booleans, these are type-guard methods you call — 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

Property Type Description
isError (this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"error", TData, TError>> Returns true if the query is in the error state, narrowing the result to that state.
isPending (this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"pending", TData, TError>> Returns true if the query is in the pending state, narrowing the result to that state.
isSuccess (this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"success", TData, TError>> Returns true if the query is in the success state, narrowing the result to that state.