prismake / typegql

Create GraphQL schema with TypeScript classes.

Home Page:https://prismake.github.io/typegql/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Are graphql list types supported?

fahrradflucht opened this issue · comments

I found no way to make arrays / graphql lists work. Aren't they supported or did I just not get it?

ah searched an hour, opened an issue and then immediately found it out. On just needs to set the type explicitly to a tuple of the list element type like so:
@Query({ type: [Product] });

Right. I'll try to make it clearer in docs as indeed, there is no clear note about this.

What I noticed is that this is kind of a predetermined breaking point isn't it? I mean neither at ts compile time nor at compileSchema time something is validating that the type I forced there matches my returned type...

Not sure if I understand. You mean - if there is any validation that would check if what your resolver returns is what you've told it will return?

If so - it will happen when schema is resolving real queries. But indeed there is no way to validate it earlier.