UNPKG

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