source.d.ts 795 B

12345678910111213141516171819202122232425
  1. interface Location {
  2. line: number;
  3. column: number;
  4. }
  5. /**
  6. * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are
  7. * optional, but they are useful for clients who store GraphQL documents in source files.
  8. * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might
  9. * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`.
  10. * The `line` and `column` properties in `locationOffset` are 1-indexed.
  11. */
  12. export class Source {
  13. body: string;
  14. name: string;
  15. locationOffset: Location;
  16. constructor(body: string, name?: string, locationOffset?: Location);
  17. }
  18. /**
  19. * Test if the given value is a Source object.
  20. *
  21. * @internal
  22. */
  23. export function isSource(source: any): source is Source;