Skip to main content

ErrorResultUnion

ErrorResultUnion

Used to construct a TypeScript return type for a query or mutation which, in the GraphQL schema, returns a union type composed of a success result (e.g. Order) plus one or more ErrorResult types.

Since the TypeScript entities do not correspond 1-to-1 with their GraphQL type counterparts, we use this type to substitute them.

Example

type UpdateOrderItemsResult = Order | OrderModificationError | OrderLimitError | NegativeQuantityError;
type T1 = ErrorResultUnion<UpdateOrderItemsResult, VendureEntityOrder>;
// T1 = VendureEntityOrder | OrderModificationError | OrderLimitError | NegativeQuantityError;
Signature
type ErrorResultUnion<T extends GraphQLErrorResult | U, E extends VendureEntity, U = any> = | JustErrorResults<T>
| E