UNPKG

1.14 kBTypeScriptView Raw
1import { ParseOptions, DocumentNode, ASTNode, StringValueNode } from 'graphql';
2export interface ExtendedParseOptions extends ParseOptions {
3 /**
4 * Set to `true` in order to convert all GraphQL comments (marked with # sign) to descriptions (""")
5 * GraphQL has built-in support for transforming descriptions to comments (with `print`), but not while
6 * parsing. Turning the flag on will support the other way as well (`parse`)
7 */
8 commentDescriptions?: boolean;
9}
10export declare function parseGraphQLSDL(location: string, rawSDL: string, options?: ExtendedParseOptions): {
11 location: string;
12 document: DocumentNode;
13 rawSDL: string;
14};
15export declare function getLeadingCommentBlock(node: ASTNode): void | string;
16export declare function transformCommentsToDescriptions(sourceSdl: string, options?: ExtendedParseOptions): DocumentNode | null;
17declare type DiscriminateUnion<T, U> = T extends U ? T : never;
18declare type DescribableASTNodes = DiscriminateUnion<ASTNode, {
19 description?: StringValueNode;
20}>;
21export declare function isDescribable(node: ASTNode): node is DescribableASTNodes;
22export {};