Skip to content

Conversation

@yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Oct 28, 2025

via using a new generic type parameter with this pattern:

export interface ExecutionResult<
  TData = ObjMap<unknown>,
  TExtensions = ObjMap<unknown>,
  TError extends GraphQLError | GraphQLFormattedError = GraphQLError,
> {
  errors?: ReadonlyArray<TError>;
  data?: TData | null;
  extensions?: TExtensions;
}

export interface FormattedExecutionResult<
  TData = ObjMap<unknown>,
  TExtensions = ObjMap<unknown>,
> extends ExecutionResult<TData, TExtensions, GraphQLFormattedError> {}

This should remove maintenance burden, as we explicitly say that the formatted types only differ from the unformatted in that they have a formatted error type.

See:
#4481
#4333

via using a new generic type parameter with this pattern:

export interface ExecutionResult<
  TData = ObjMap<unknown>,
  TExtensions = ObjMap<unknown>,
  TError extends GraphQLError | GraphQLFormattedError = GraphQLError,
> {
  errors?: ReadonlyArray<TError>;
  data?: TData | null;
  extensions?: TExtensions;
}

export interface FormattedExecutionResult<
  TData = ObjMap<unknown>,
  TExtensions = ObjMap<unknown>,
> extends ExecutionResult<TData, TExtensions, GraphQLFormattedError> {}

This should remove maintenance burden, as we explicitly say that the formatted types only differ from the unformatted in that they have a formatted error type.
@yaacovCR yaacovCR requested a review from a team as a code owner October 28, 2025 11:42
@yaacovCR yaacovCR added the PR: polish 💅 PR doesn't change public API or any observed behaviour label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: polish 💅 PR doesn't change public API or any observed behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant