UNPKG

graphql-composer

Version:
39 lines (38 loc) 1.35 kB
import { GraphQLEnumType } from "graphql"; import { StringKeyOf, EnumValue, Removable } from "../../../.."; import { GQLAnyType } from "../../GQLAnyType"; export declare class EnumType<TEnumType extends Object = any, ExtensionsType = any> extends GQLAnyType<GraphQLEnumType, ExtensionsType> { private _values; private _enumType?; get enumType(): TEnumType; get values(): readonly EnumValue<StringKeyOf<TEnumType>>[]; protected constructor(name: string, enumType?: TEnumType); /** * Create an EnumType */ static create(name: string): EnumType; static create<T extends Object>(name: string, enumType: T): EnumType<T>; /** * Set the enum values * @param values The values to add */ setValues(...values: EnumValue<StringKeyOf<TEnumType>>[]): this; /** * Add some enum values * @param values The values to add */ addValues(...values: EnumValue<StringKeyOf<TEnumType>>[]): this; /** * Add a single enum value * @param name the value name * @param value the value */ addValue(name: StringKeyOf<TEnumType>, value: any): this; /** * Remove some values from the enum * @param values The values to remove */ removeValues(...values: Removable<EnumValue>): this; copy(): EnumType<any, any>; build(): GraphQLEnumType; }