Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't Expose Mabye<T> in typescript def #2807

Closed

Conversation

ctopherhague
Copy link

Pull 2621 Removed Maybe from tsutils export, however it still remains in the def for GraphQLError.originalError.

This broke our use case where we have leverage customFormatErrorFn in express, in which we :

export function errorHandler(error?: Error) {
	//
}

errorHandler(error.originalError); 

Results in:

Argument of type 'Maybe<Error>' is not assignable to parameter of type 'Error | undefined'.
  Type 'null' is not assignable to type 'Error | undefined'.ts(2345)

We could go the route of the Apollo Fix and re-define maybe in our own package, but if this is doable, would like to simply not expose it in GraphQLError.d.ts

@IvanGoncharov
Copy link
Member

@ctopherhague Maybe is still exported just in different folder jsutils.
Your issue is that you need to write export function errorHandler(error?: Error | null).
Note: In 16.0.0 we are planning to do breaking change and remove all Maybe wrappers.

dimitropoulos added a commit to dimitropoulos/insomnia that referenced this pull request Mar 10, 2022
this is due to codemirror-graphql using the Maybe type that has been removed from graphql graphql/graphql-js#2807
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants