{"id":25655,"library":"graphql-schema-transpiler","title":"graphql-schema-transpiler","description":"A transpiler that extends standard GraphQL schema syntax to support type inheritance among `type`, `input`, and `interface` definitions, allowing single and multiple inheritance to reduce boilerplate. Version 1.0.1 is the latest stable release; no active development or release cadence is documented. Unlike GraphQL tools that rely on code-first approaches or schema stitching, this package operates purely at the schema text level, making it simple to integrate into existing build pipelines. It also supports field type conversion when inheriting between `type` and `input` schemas.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/wenfzhao/graphql-schema-transpiler","tags":["javascript","graphql","schema","transpiler","inheritance","extends","nodejs"],"install":[{"cmd":"npm install graphql-schema-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-schema-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-schema-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package exports transpileSchema as a named export, not default. CommonJS requires destructuring.","wrong":"const transpileSchema = require('graphql-schema-transpiler')","symbol":"transpileSchema","correct":"import { transpileSchema } from 'graphql-schema-transpiler'"},{"note":"Default export does not exist; use named import via destructuring.","wrong":"const transpileSchema = require('graphql-schema-transpiler').default","symbol":"transpileSchema (CommonJS)","correct":"const { transpileSchema } = require('graphql-schema-transpiler')"},{"note":"Package does not ship TypeScript definitions; use @types/graphql or declare module manually.","symbol":"TypeScript import","correct":"import { transpileSchema } from 'graphql-schema-transpiler'"}],"quickstart":{"code":"import { transpileSchema } from 'graphql-schema-transpiler';\n\nconst schema = `\ntype Person {\n  firstName: String!\n  lastName: String!\n}\n\ntype Employee extends Person {\n  jobTitle: String!\n}\n`;\n\nconst transpiled = transpileSchema(schema, {\n  addMissingTypesAndInputs: true,\n});\n\nconsole.log(transpiled);\n/* Output:\n\ntype Person {\n  firstName: String!\n  lastName: String!\n}\n\ntype Employee {\n  jobTitle: String!\n  firstName: String!\n  lastName: String!\n}\n*/","lang":"typescript","description":"Transpile a GraphQL schema with type inheritance to standard GraphQL, creating a new schema string with all inherited fields copied."},"warnings":[{"fix":"Check generated input types for correctness; use `addMissingTypesAndInputs: false` to skip auto-conversion.","message":"Field type conversion from output to input types when inheriting from type to input may produce unexpected results if unmapped fields exist.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid circular dependencies; validate schema before transpilation.","message":"Circular inheritance (e.g., type A extends B, B extends A) may cause infinite recursion or stack overflow.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure field names are unique across parent types or rely on first-come-first-served behavior.","message":"Multiple inheritance order matters: fields from later parents may override earlier ones if duplicates exist. Not explicitly documented.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Review generated input types for nullability changes; override fields explicitly.","message":"Input types inherited from type definitions may lose non-null constraints if child specifies default values.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install @types/graphql or add custom typings: declare module 'graphql-schema-transpiler';","cause":"Package lacks TypeScript type definitions; TypeScript strict mode might not resolve module.","error":"Cannot find module 'graphql-schema-transpiler' or its corresponding type declarations."},{"fix":"Use const { transpileSchema } = require('graphql-schema-transpiler'); or import { transpileSchema } from 'graphql-schema-transpiler';","cause":"CommonJS require used without destructuring, or wrong import syntax.","error":"Uncaught TypeError: transpileSchema is not a function"},{"fix":"Remove circular extends clauses from schema types.","cause":"Circular inheritance in schema definition.","error":"Maximum call stack size exceeded"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}