nicolasgere/graphql-ts

Promise & Function return support

SergeShkurko opened this issue · 5 comments

graphql-ts not support Function & Promise how objectType method return type
2
default

default
2

But the standard graphql supports it normally
default
Please fix it bug, thanks

@SergeShkurko i will work on that when i have time, in 2 week max, thanks for the feedback

pie6k commented

Any update?

@pie6k , @SergeShkurko due to typescript metadata support for complexe type, you have to specify the return type with @returnType(date) . You can see a discution about this here

and for the function return type i see nothing about this in the graphql specification, can i have a link?

@nicolasgere It's mentioned here: https://github.com/graphql/graphql-js
under Getting Started/Using GraphQL.js subsection.

The resolve function can return a value, a promise, or an array of promises. A more complex example is included in the top level tests directory.

image

@poliron0 , GraphQl-ts support both, just do not forget to specify @returnType(T)