import { isGraphQlErrorResult } from '@vendure/core';// ...const transitionResult = await this.orderService.transitionToState(ctx, order.id, newState);if (isGraphQlErrorResult(transitionResult)) { // The transition failed with an ErrorResult throw transitionResult;} else { // TypeScript will correctly infer the type of `transitionResult` to be `Order` return transitionResult;}