sikanhe / gqtx

Code-first Typescript GraphQL Server without codegen or metaprogramming
458 stars 13 forks source link

fix: prevent resolver from widening output type #74

Closed andrew0 closed 9 months ago

andrew0 commented 9 months ago

If the resolver for a field returns a union where one of the constituents satisfies the expected type, then TypeScript widens the Out type to allow the union, but the resolver's type should be limited to what the type option allows. Adding this NoInfer utility prevents TypeScript from widening the type in this case.

sikanhe commented 9 months ago

nice 💯