graphql/language/printing
Functions
print()
Converts an AST into a string, using one set of reasonable formatting rules.
Signature:
print(ast: ASTNode): string
Arguments
| Name | Type | Description |
|---|---|---|
| ast | ASTNode | The GraphQL AST node to print. |
Returns
| Type | Description |
|---|---|
string | A stable string representation of the AST. |
Example
import { parse, print } from 'graphql';
const ast = parse('{ hero { name } }');
const text = print(ast);
// text:
// {
// hero {
// name
// }
// }