import { DefinitionNode } from "graphql"; /** * This transform visits argument default values checking for values used in * enum positions. * * ## String Literals * * If a string literal default value is used in a position that is typed as a * GraphQL enum, replace it with an enum value of the same name. * * Grats supports modeling enums as a union of string literals. In this case, a * possible default input value for an enum would be a string literal. However, * in the GraphQL schema we generate we want the default to be repetend as an * GraphQL enum, not a string. * * At extraction time, we are not GraphQL type aware, so we don't know if a * string literal in a default position is representing an enum variant or a * string literal. Instead, we must do this as a fix-up transform after we have * collected all types definitions. * * ## Enum Literals * * If we encountered a TypeScript enum in a default value during extraction * (`MyEnum.SomeValue`), we just extract it as an enum `SomeValue`. However, * the initializer of that TypeScript enum may be some other name. We need to * coerce the default value to the correct enum value. * * When we record enum value definitions in the schema, we record the TypeScript * name of the enum value as `tsName`. This allows us to look up the correct * enum value in this transform by visiting each of the enum values and checking * if the `tsName` matches the extracted value. * * Note: If a type-mismatch is encountered the transformation is skipped on the * assumption that a later validation pass will detect the error. */ export declare function coerceDefaultEnumValues(definitions: Array): DefinitionNode[];