comments.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import { StringValueNode, ASTNode, NameNode, DefinitionNode, Location } from 'graphql';
  2. export declare type NamedDefinitionNode = DefinitionNode & {
  3. name?: NameNode;
  4. };
  5. export declare function resetComments(): void;
  6. export declare function collectComment(node: NamedDefinitionNode): void;
  7. export declare function pushComment(node: any, entity: string, field?: string, argument?: string): void;
  8. export declare function printComment(comment: string): string;
  9. /**
  10. * Converts an AST into a string, using one set of reasonable
  11. * formatting rules.
  12. */
  13. export declare function printWithComments(ast: ASTNode): string;
  14. export declare function getDescription(node: {
  15. description?: StringValueNode;
  16. loc?: Location;
  17. }, options?: {
  18. commentDescriptions?: boolean;
  19. }): string | undefined;
  20. export declare function getComment(node: {
  21. loc?: Location;
  22. }): undefined | string;
  23. export declare function getLeadingCommentBlock(node: {
  24. loc?: Location;
  25. }): void | string;
  26. export declare function dedentBlockStringValue(rawString: string): string;
  27. /**
  28. * @internal
  29. */
  30. export declare function getBlockStringIndentation(lines: ReadonlyArray<string>): number;