import { GraphQLNonNull , GraphQLEnumType } from 'graphql' ; import { StrongInputOutputType } from './type' ; import { trimDescriptionsInConfig } from './description' ; /**
 * Creates a type-safe non-null enum GraphQL type.
 */ export function createEnumType < TValue > ( config ) { return new StrongEnumType < TValue > ( new StrongNullableEnumType < TValue > ( trimDescriptionsInConfig ( config ) ) ) ; } /**
 * The configuration for an enum type.
 */ export type StrongEnumTypeConfig < TValue > = { readonly name : string ; readonly description ? : string | undefined ; readonly values : { readonly [ valueName ] : { readonly value : TValue ; readonly description ? : string | undefined ; readonly deprecationReason ? : string | undefined ; } ; } ; } ; /**
 * The non-null strong GraphQL enum type object.
 */ class StrongEnumType < TValue > extends GraphQLNonNull < StrongNullableEnumType < TValue > > implements StrongInputOutputType < TValue > { public readonly _strongType : true = true ; public readonly _strongInputType : true = true ; public readonly _strongOutputType : true = true ; public readonly _strongValue : TValue = undefined as any ; constructor ( nullableType ) { super ( nullableType ) ; } public getWeakType ( ) { return this ; } public getWeakInputType ( ) { return this ; } public getWeakOutputType ( ) { return this ; } /**
     * Returns the inner nullable variation of this type.
     */ public nullable ( ) { return this . ofType ; } } /**
 * The nullable sstrong GraphQL enum type object.
 */ class StrongNullableEnumType < TValue > extends GraphQLEnumType implements StrongInputOutputType < TValue | null | undefined > { public readonly _strongType : true = true ; public readonly _strongInputType : true = true ; public readonly _strongOutputType : true = true ; public readonly _strongValue : TValue | null | undefined = undefined as any ; constructor ( config ) { super ( config ) ; } public getWeakType ( ) { return this ; } public getWeakInputType ( ) { return this ; } public getWeakOutputType ( ) { return this ; } /**
     * Returns self.
     */ public nullable ( ) { return this ; } }