w3tecch / express-graphql-typescript-boilerplate

A starter kit for building amazing GraphQL API's with TypeScript and express by @w3tecch
MIT License
185 stars 73 forks source link

Use external library for type definitions #11

Open pie6k opened 6 years ago

pie6k commented 6 years ago

GraphqlFieldConfig interface for defining types is glueing code definition with this very framework/boilerplate.

What do you think about using some external library like https://github.com/prismake/typegql

@ObjectType({ description: 'Simple product object type' })
class Product {
  @Field() name: string;

  @Field() price: number;

  @Field()
  isExpensive() {
    return this.price > 50;
  }
}

It allows you to define type in such way, but it still compiles to plain GraphQL object type that will work with every schema