author import { WriteStream } from "fs" ; import { GraphQLEnumType } from "graphql" ; import { GeneratorConfig } from "./GeneratorConfig" ; import { Writer } from "./Writer" ; export class EnumWriter extends Writer { constructor ( private readonly enumType , stream , config ) { super ( stream , config ) ; } protected writeCode ( ) { const t = this . text . bind ( this ) ; t ( "export type " ) ; t ( this . enumType . name ) ; t ( " = " ) ; const values = this . enumType . getValues ( ) ; this . enter ( "BLANK" , values . length > 3 ) ; for ( const value of values ) { this . separator ( " | " ) ; t ( "'" ) ; t ( value . name ) ; t ( "'" ) ; } this . leave ( ";\n" ) ; } }