From 67dba4b5a78f585c2f74c8531ba7b6cfd72050be Mon Sep 17 00:00:00 2001 From: Firede Date: Mon, 27 Mar 2017 17:16:24 +0800 Subject: [PATCH] add `findDeprecatedUsages`. --- types/graphql/utilities/findDeprecatedUsages.d.ts | 13 +++++++++++++ types/graphql/utilities/index.d.ts | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 types/graphql/utilities/findDeprecatedUsages.d.ts diff --git a/types/graphql/utilities/findDeprecatedUsages.d.ts b/types/graphql/utilities/findDeprecatedUsages.d.ts new file mode 100644 index 0000000000..58e9ae1685 --- /dev/null +++ b/types/graphql/utilities/findDeprecatedUsages.d.ts @@ -0,0 +1,13 @@ +import { GraphQLSchema } from '../type/schema'; +import { DocumentNode } from '../language/ast'; +import { GraphQLError } from '../error/GraphQLError'; + +/** + * A validation rule which reports deprecated usages. + * + * Returns a list of GraphQLError instances describing each deprecated use. + */ +export function findDeprecatedUsages( + schema: GraphQLSchema, + ast: DocumentNode +): Array diff --git a/types/graphql/utilities/index.d.ts b/types/graphql/utilities/index.d.ts index 47cfd70ff9..8815046735 100644 --- a/types/graphql/utilities/index.d.ts +++ b/types/graphql/utilities/index.d.ts @@ -73,3 +73,6 @@ export { assertValidName } from './assertValidName'; // Compares two GraphQLSchemas and detects breaking changes. export { findBreakingChanges } from './findBreakingChanges'; export { BreakingChange } from './findBreakingChanges'; + +// Report all deprecated usage within a GraphQL document. +export { findDeprecatedUsages } from './findDeprecatedUsages';