mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-13 17:16:21 +08:00
make graphql typing for getDescription conform with graphql-js
This commit is contained in:
4
types/graphql/index.d.ts
vendored
4
types/graphql/index.d.ts
vendored
@@ -12,6 +12,7 @@
|
||||
// Tim Griesser <https://github.com/tgriesser>
|
||||
// Dylan Stewart <https://github.com/dyst5422>
|
||||
// Alessio Dionisi <https://github.com/adnsio>
|
||||
// Divyendu Singh <https://github.com/divyenduz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -100,6 +101,9 @@ export {
|
||||
// Build a GraphQLSchema from a GraphQL schema language document.
|
||||
buildSchema,
|
||||
|
||||
// Get the description of an AST node
|
||||
getDescription,
|
||||
|
||||
// Extends an existing GraphQLSchema from a parsed GraphQL Schema
|
||||
// language AST.
|
||||
extendSchema,
|
||||
|
||||
13
types/graphql/utilities/buildASTSchema.d.ts
vendored
13
types/graphql/utilities/buildASTSchema.d.ts
vendored
@@ -1,7 +1,13 @@
|
||||
import { DocumentNode, Location } from '../language/ast';
|
||||
import { DocumentNode, Location, StringValueNode } from '../language/ast';
|
||||
import { Source } from '../language/source';
|
||||
import { GraphQLSchema } from '../type/schema';
|
||||
|
||||
type BuildSchemaOptions = {
|
||||
assumeValid?: boolean;
|
||||
allowedLegacyNames?: ReadonlyArray<string>;
|
||||
commentDescriptions?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* This takes the ast of a schema document produced by the parse function in
|
||||
* src/language/parser.js.
|
||||
@@ -18,7 +24,10 @@ export function buildASTSchema(ast: DocumentNode): GraphQLSchema;
|
||||
* Given an ast node, returns its string description based on a contiguous
|
||||
* block full-line of comments preceding it.
|
||||
*/
|
||||
export function getDescription(node: { loc?: Location }): string;
|
||||
export function getDescription(
|
||||
node: { description?: StringValueNode; loc?: Location },
|
||||
options: BuildSchemaOptions
|
||||
): string;
|
||||
|
||||
/**
|
||||
* A helper function to build a GraphQLSchema directly from a source
|
||||
|
||||
2
types/graphql/utilities/index.d.ts
vendored
2
types/graphql/utilities/index.d.ts
vendored
@@ -27,7 +27,7 @@ export { getOperationAST } from './getOperationAST';
|
||||
export { buildClientSchema } from './buildClientSchema';
|
||||
|
||||
// Build a GraphQLSchema from GraphQL Schema language.
|
||||
export { buildASTSchema, buildSchema } from './buildASTSchema';
|
||||
export { buildASTSchema, buildSchema, getDescription } from './buildASTSchema';
|
||||
|
||||
// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST.
|
||||
export { extendSchema } from './extendSchema';
|
||||
|
||||
Reference in New Issue
Block a user