ResolverTypeWrapper on mapper types is redundant? #10231
Unanswered
warrenfalk
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I think maybe this is a bug, but I'm not sure.
If I define a mapper type
This results in a change from this:
...to the following:
ResolverTypeWrapper
is defined astype ResolverTypeWrapper<T> = Promise<T> | T
which is easy to understand, butResolverFn
is already defined with the return typePromise<T> | T
.I don't understand this. The generated
Thing
type is not of the shapePromise<T> | T
so why does ModelThing need to be of the shapePromise<T> | T
? Wrapping it like that results in resolvers having the return typePromise<Promise<T> | T> | Promise<T> | T
. Although this doesn't cause any problems because await is recursive such thatAwaited<Promise<Promise<T> | T> | Promise<T> | T>
==T
, it does result in types that are more difficult to understand (and also makes it difficult to write conditional types withinfer
that are based on these).From what I can tell, wrapping these in
ResolverTypeWrapper
doesn't do anything but complicate the types. I am not sure there's a reason to even haveResolverTypeWrapper
.So is this a bug?
Beta Was this translation helpful? Give feedback.
All reactions