QueryResult
QueryResult<
T,E> = {data:undefined;error:null;isError:false;isPending:true;isSuccess:false;status:"pending";refetch:Promise<void>; } | {data:T;error:null;isError:false;isPending:false;isSuccess:true;status:"success";refetch:Promise<void>; } | {data:T|undefined;error:E;isError:true;isPending:false;isSuccess:false;status:"error";refetch:Promise<void>; }
Defined in: console-sdk/src/firmware/types.ts:45
The SDK’s one request-shaped read contract (SDK_PLAN.md §3.9.2). A
discriminated union over status, with matching boolean flags so callers
can branch on whichever reads best (status === 'success' or isSuccess)
and get data narrowed to T with no non-null assertions.
The 'error' variant keeps the last-known data (stale-while-error) so a
failed refresh never blanks a card that was previously populated. Every
variant carries refetch() to re-run the read.
Type Parameters
Section titled “Type Parameters”T
the successfully-loaded data shape.
E extends FirmwareError = FirmwareError
the error type on failure; defaults to FirmwareError (the only request-shaped read is firmware status).
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ data: undefined; error: null; isError: false; isPending: true; isSuccess: false; status: "pending"; refetch: Promise<void>; }
data:
undefined
No data yet.
error:
null
No error.
isError
Section titled “isError”isError:
false
Always false in this variant.
isPending
Section titled “isPending”isPending:
true
Always true in this variant.
isSuccess
Section titled “isSuccess”isSuccess:
false
Always false in this variant.
status
Section titled “status”status:
"pending"
The read is in flight and has no prior data.
refetch()
Section titled “refetch()”refetch():
Promise<void>
Re-runs the read.
Returns
Section titled “Returns”Promise<void>
Type Literal
Section titled “Type Literal”{ data: T; error: null; isError: false; isPending: false; isSuccess: true; status: "success"; refetch: Promise<void>; }
data:
T
The loaded data.
error:
null
No error.
isError
Section titled “isError”isError:
false
Always false in this variant.
isPending
Section titled “isPending”isPending:
false
Always false in this variant.
isSuccess
Section titled “isSuccess”isSuccess:
true
Always true in this variant.
status
Section titled “status”status:
"success"
The read succeeded; data is populated.
refetch()
Section titled “refetch()”refetch():
Promise<void>
Re-runs the read.
Returns
Section titled “Returns”Promise<void>
Type Literal
Section titled “Type Literal”{ data: T | undefined; error: E; isError: true; isPending: false; isSuccess: false; status: "error"; refetch: Promise<void>; }
data:
T|undefined
Last-known data if a prior read succeeded, else undefined
(stale-while-error — a failed refresh does not blank the card).
error:
E
The failure.
isError
Section titled “isError”isError:
true
Always true in this variant.
isPending
Section titled “isPending”isPending:
false
Always false in this variant.
isSuccess
Section titled “isSuccess”isSuccess:
false
Always false in this variant.
status
Section titled “status”status:
"error"
The read failed; error is populated.
refetch()
Section titled “refetch()”refetch():
Promise<void>
Re-runs the read.
Returns
Section titled “Returns”Promise<void>