type-graphql: Better checking and meaningfull errors

Please feel free to comment in this issue and tell what check is missing or what check throw not detailed errors!

  • more info about the need to provide explicit type
  • more info about problems with determining GraphQL type for property/argument (@esindger)
  • using @Args with @InputType or without @ArgsType
  • inform about missing reflect-metadata polyfill
  • missing @InterfaceType on class provided to { implements: SomeClass } (@gdanov)
  • more details in message when GeneratingSchemaError occured
  • duplicated arg name
  • description/depreciation on not supported field
  • multiple usage of @Args()
  • field resolver not matching resolver object type
  • using @Arg with @ArgsType class
  • duplicated query/mutation name (now it overwrites)
  • overwriting interface/base class field types
  • creating field resolver for method resolver
  • no resolver files match glob pattern
  • detect ES5 compilation (no Function.name)
  • detect undefined or other invalid values provided by mistake in type => X
  • detect wrong target setting and arrow function detection issue (#206, #219)
  • more specific error message when root Query is missing (#218)
  • using defaultValue option in @Field placed in @ObjectType
  • abstract type is used directly in GraphQL schema
  • checking implementation of all abstract interface field resolvers
  • inform that decorators don’t work on static methods (@karladler)
  • duplicated types/enums before schema auto-check (with stacktrace to point source files)
  • …others 😜

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 20
  • Comments: 20 (8 by maintainers)

Most upvoted comments

more info about the need to provide explicit type

Type definition error text is unclear. For example, if I try to use output type in mutation, I got an error

(node:10303) UnhandledPromiseRejectionWarning: Error: Cannot determine GraphQL input type for filter

How to figure out what exactly type was missed?

It would be nice to provide some additional info:

  • resolver name
  • query/mutation name
  • argument name

This issue is really important.

I’ve added a bunch of changes to errors system in 0.18.0-beta.16 release:

  • more info about the need to provide explicit type
  • more info about problems with determining GraphQL type for property/argument (@esindger)
  • using @Args with @InputType or without @ArgsType
  • missing @InterfaceType on class provided to { implements: SomeClass } (@gdanov)
  • more details in message when GeneratingSchemaError occured

Please let me know if the new error messages are informative enough or they have missing some valuable info 😉

This is an extremely important issue.

I have a fairly complex Graphql schema using typegraphql and wasn’t getting any typescript errors. However, when buildschema was executed after some time it started throwing “Cannot determine Graphql output type for items” errors. But, I have no clue where the issue exactly is.

I already have the following set:

        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,

Loving the new error messages! I can only guess how much time this error message has saved me Error: The value used as a type of '@Args' for 'addProduct' of 'ProductResolver' is not a class decorated with '@ArgsType' decorator!