跳到正文
TakoAPI
返回技能列表

neo-graphql-ts-generator

由 martinforsulu 提供

Web & Frontend Development
—暂无评分
你的评分

简介

Automatically generates TypeScript types from GraphQL schema files with CLI integration for developers and AI agents.

描述

该技能的功能

Converts GraphQL schema files (.graphql, .gql) to TypeScript interfaces, types, unions, and enums via a CLI tool. Handles complex schema features including discriminated unions, interfaces, and nullability. Can process single files or batches.

Eliminates hand-writing TypeScript types that must stay in sync with a GraphQL schema, removing a common source of type drift.

何时使用

  • Generate TypeScript types from a REST-to-GraphQL migration
  • Sync client-side types after backend schema updates
  • Batch-convert all schemas in a monorepo at once
  • Automate type generation in a CI pipeline
  • Get typed interfaces from a third-party GraphQL API schema

示例工作流

输入

User asks: Generate TypeScript types from /docs/api.graphql

智能体
  1. 1

    Receives the schema file path from the user

  2. 2

    Runs graphql-ts-generator /docs/api.graphql via CLI

  3. 3

    Parser validates and converts the schema to an AST

  4. 4

    Generator transforms AST nodes to TypeScript interfaces, unions, and enums

  5. 5

    Writes output .ts files to the dist/ directory

输出

TypeScript type files ready to import into the project

安装

clawhub install martinforsulu/neo-graphql-ts-generator

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接