Back to Graphql Code Generator

typescript-type-graphql

website/src/pages/plugins/typescript/typescript-type-graphql.mdx

1.17.7978 B
Original Source

import { PluginApiDocs, PluginHeader } from '@/components/plugin' import { pluginGetStaticProps } from '@/lib/plugin-get-static-props' export const getStaticProps = pluginGetStaticProps(__filename)

<PluginHeader />

This plugin is similar to the basic TypeScript plugin. However, this package generates types that can be used by TypeGraphQL to generate a GraphQL schema. This is especially useful if you are building a service that is a gateway to multiple downstream GraphQL services, or otherwise combining GraphQL schemas. In this case, this plugin can be used to re-expose types defined in downstream GraphQL services without redefining them as TypeGraphQL objects. This plugin should be compatible with other client-side plugins, such as typescript-operations.

Some differences with the types generated by the basic TypeScript plugin:

  • classes are generated instead of interfaces
  • TypeGraphQL decorators like @ObjectType and @Field will be added
<PluginApiDocs />