Generates TypeScript/JavaScript type annotations and API code from AWS AppSync GraphQL schemas and statements. Current version: 2.8.5. Part of the AWS Amplify CLI ecosystem, it parses `.graphql` files and emits typed operations (queries, mutations, subscriptions) plus TypeScript interfaces matching the schema. Compared to `graphql-codegen`, it is tightly coupled to Amplify's workflow and automatically handles AppSync-specific directives like `@model`, `@auth`, and `@connection`. Stable but slow release cadence; primarily used within `amplify push` or `amplify codegen` workflows. Requires Node >=12.0.0. Supports both JavaScript and TypeScript output.
npm install amplify-graphql-types-generatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to read a GraphQL schema and documents, generate TypeScript types, and write them to a file.
Replace `generateType: 'typescript'` with `target: 'typescript'` in options.
Remove `addTypename` from options.
Convert URL objects to file path strings before passing to generate.
Use `target: 'typescript'` or `target: 'flow'`.
Migrate to TypeScript target.
Run `npm install amplify-graphql-types-generator` or `yarn add amplify-graphql-types-generator`.
Use named import: `import { generate } from 'amplify-graphql-types-generator'`.Add `scalars: { AWSDateTime: 'string' }` to the options object.Ensure the documents file contains at least one query, mutation, or subscription.
Validate the schema file using a GraphQL validator or the Amplify CLI.