Skip to content

fix: cast NexusNonNullDef to prevent union type complexity error #846

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

Merged
merged 2 commits into from
Mar 4, 2021

Conversation

tgriesser
Copy link
Member

@tgriesser tgriesser commented Mar 1, 2021

Ran into an issue around the generated return type for nonNull(), which produces:

NexusNonNullDef<any> | (TypeName & GraphQLNonNull<any>)

This is problematic when you reach a decent amount of types, where you'll hit a union type that is too complex to represent error. Removing the right hand side of the clause resolves the issue, and the fact that it's a GraphQLNonNull type is irrelevant, so we can just cast it to NexusNonNullDef<any> here

@codecov
Copy link

codecov bot commented Mar 1, 2021

Codecov Report

Merging #846 (0435794) into main (d220d31) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #846   +/-   ##
=======================================
  Coverage   93.91%   93.91%           
=======================================
  Files          46       46           
  Lines        2959     2959           
  Branches      695      695           
=======================================
  Hits         2779     2779           
  Misses        178      178           
  Partials        2        2           

Copy link
Contributor

@jasonkuhrt jasonkuhrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an easy thing to regress. Maybe a comment if not a test. LGTM!

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@jasonkuhrt jasonkuhrt merged commit 7f16b8b into main Mar 4, 2021
@jasonkuhrt jasonkuhrt deleted the tgriesser/fix/nonNullTyping branch March 4, 2021 19:24
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.

None yet

2 participants