GraphQL to TypeScript code generator that derives TypeScript types from GraphQL queries, fragments, and mutations. Version 1.0.2 is the latest stable release. It generates typed query function signatures (including variables and return types) directly from .graphql files, copying the query string into the output for easy reuse. Key differentiators: lightweight, no runtime dependency, supports Variables utility type, and outputs type-only imports. Unlike alternatives (GraphQL Code Generator, graphql-let), megaera focuses on simplicity and minimal configuration, with a single CLI command.
npm install megaeraNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Generates TypeScript types for all GraphQL queries, then imports and uses the generated query variable and its return type.
Ensure the glob pattern matches all .graphql files. Output location can be adjusted via --out-dir if needed.
Use ReturnType<typeof importedVariable> or ReturnType<ImportedType> to extract the query result type.
Use import { Variables } from 'megaera' then type Vars = Variables<UserQuery>.Run 'npm install megaera' or 'yarn add megaera'.
Use ReturnType<IssuesQuery> to get the result type.
No dependency data recorded yet.