UNPKG

1.43 kBTypeScriptView Raw
1import { GraphQLEnumType, GraphQLInputObjectType, GraphQLType } from 'graphql';
2import { CompilerOptions } from 'apollo-codegen-core/lib/compiler';
3import * as t from '@babel/types';
4export declare type ObjectProperty = {
5 name: string;
6 description?: string | null | undefined;
7 type: t.TSType;
8};
9export interface TypescriptCompilerOptions extends CompilerOptions {
10}
11export default class TypescriptGenerator {
12 options: TypescriptCompilerOptions;
13 typeFromGraphQLType: Function;
14 constructor(compilerOptions: TypescriptCompilerOptions);
15 enumerationDeclaration(type: GraphQLEnumType): t.ExportNamedDeclaration;
16 inputObjectDeclaration(inputObjectType: GraphQLInputObjectType): t.ExportNamedDeclaration;
17 typesForProperties(fields: ObjectProperty[], { keyInheritsNullability }?: {
18 keyInheritsNullability?: boolean;
19 }): t.TSPropertySignature[];
20 interface(name: string, fields: ObjectProperty[], { keyInheritsNullability }?: {
21 keyInheritsNullability?: boolean;
22 }): t.TSInterfaceDeclaration;
23 typeAliasGenericUnion(name: string, members: t.TSType[]): t.TSTypeAliasDeclaration;
24 exportDeclaration(declaration: t.Declaration): t.ExportNamedDeclaration;
25 nameFromScopeStack(scope: string[]): string;
26 makeNullableType(type: t.TSType): t.TSUnionType;
27 isNullableType(type: t.TSType): boolean;
28 import(types: GraphQLType[], source: string): t.ImportDeclaration;
29}