@graphitation/ts-codegen
This package generates Typescript definitions based on GraphQL Schema Definition Language.
Parameters
document
(DocumentNode): The GraphQL document consisting the schema definitions to generate TypeScript code from.options
(GenerateTSOptions): An object containing various options for the code generation.
Options
Below is the list of all flags that can be passed to the code generator (see codegen.ts).
export interface GenerateTSOptions {
outputPath: string;
documentPath: string;
contextTypePath?: string | null;
contextTypeName?: string;
enumsImport?: string | null;
legacyCompat?: boolean;
useStringUnionsInsteadOfEnums?: boolean;
legacyNoModelsForObjects?: boolean;
modelScope?: string | null;
generateOnlyEnums?: boolean;
enumNamesToMigrate?: string[];
enumNamesToKeep?: string[];
contextSubTypeNameTemplate?: string;
contextSubTypePathTemplate?: string;
defaultContextSubTypePath?: string;
defaultContextSubTypeName?: string;
generateResolverMap?: boolean;
}