diff --git a/types/graphql/error/GraphQLError.d.ts b/types/graphql/error/GraphQLError.d.ts index 857f25b593..fbafcb1e30 100644 --- a/types/graphql/error/GraphQLError.d.ts +++ b/types/graphql/error/GraphQLError.d.ts @@ -9,7 +9,6 @@ import { Source } from '../language/source'; * GraphQL document and/or execution result that correspond to the Error. */ export class GraphQLError extends Error { - /** * A message describing the Error for debugging purposes. * @@ -40,7 +39,7 @@ export class GraphQLError extends Error { /** * An array of GraphQL AST Nodes corresponding to this error. */ - nodes?: Array | undefined; + nodes?: ASTNode[] | undefined; /** * The source GraphQL document corresponding to this error. @@ -51,7 +50,7 @@ export class GraphQLError extends Error { * An array of character offsets within the source GraphQL document * which correspond to this error. */ - positions?: Array | undefined; + positions?: number[] | undefined; /** * The original error thrown from a field resolver during execution. @@ -60,9 +59,9 @@ export class GraphQLError extends Error { constructor( message: string, - nodes?: Array, + nodes?: any[], source?: Source, - positions?: Array, + positions?: number[], path?: Array, originalError?: Error, ); diff --git a/types/graphql/error/formatError.d.ts b/types/graphql/error/formatError.d.ts index 5b974d5461..fbb31cdb23 100644 --- a/types/graphql/error/formatError.d.ts +++ b/types/graphql/error/formatError.d.ts @@ -6,13 +6,13 @@ import { GraphQLError } from './GraphQLError'; */ export function formatError(error: GraphQLError): GraphQLFormattedError; -export type GraphQLFormattedError = { - message: string, - locations?: Array, - path?: Array -}; +export interface GraphQLFormattedError { + message: string; + locations?: GraphQLErrorLocation[]; + path?: Array; +} -export type GraphQLErrorLocation = { - line: number, - column: number -}; +export interface GraphQLErrorLocation { + line: number; + column: number; +} diff --git a/types/graphql/error/index.d.ts b/types/graphql/error/index.d.ts index 50fe58c06a..cfb5b92740 100644 --- a/types/graphql/error/index.d.ts +++ b/types/graphql/error/index.d.ts @@ -1,4 +1,4 @@ export { GraphQLError } from './GraphQLError'; export { syntaxError } from './syntaxError'; export { locatedError } from './locatedError'; -export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from './formatError'; \ No newline at end of file +export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from './formatError'; diff --git a/types/graphql/error/locatedError.d.ts b/types/graphql/error/locatedError.d.ts index 8aca478f03..c827f8ede8 100644 --- a/types/graphql/error/locatedError.d.ts +++ b/types/graphql/error/locatedError.d.ts @@ -7,6 +7,6 @@ import { GraphQLError } from './GraphQLError'; */ export function locatedError( originalError: Error, - nodes: Array, + nodes: T[], path: Array ): GraphQLError; diff --git a/types/graphql/error/syntaxError.d.ts b/types/graphql/error/syntaxError.d.ts index d57b292211..80c4453e03 100644 --- a/types/graphql/error/syntaxError.d.ts +++ b/types/graphql/error/syntaxError.d.ts @@ -9,4 +9,4 @@ export function syntaxError( source: Source, position: number, description: string -): GraphQLError; \ No newline at end of file +): GraphQLError; diff --git a/types/graphql/execution/execute.d.ts b/types/graphql/execution/execute.d.ts index 48ee78840a..782310b6f4 100644 --- a/types/graphql/execution/execute.d.ts +++ b/types/graphql/execution/execute.d.ts @@ -22,7 +22,7 @@ export interface ExecutionContext { rootValue: any; operation: OperationDefinitionNode; variableValues: { [key: string]: any }; - errors: Array; + errors: GraphQLError[]; } /** @@ -32,7 +32,7 @@ export interface ExecutionContext { */ export interface ExecutionResult { data?: { [key: string]: any }; - errors?: Array; + errors?: GraphQLError[]; } /** diff --git a/types/graphql/execution/values.d.ts b/types/graphql/execution/values.d.ts index e6a0be63cc..3f6e909ed7 100644 --- a/types/graphql/execution/values.d.ts +++ b/types/graphql/execution/values.d.ts @@ -10,9 +10,9 @@ import { FieldNode, DirectiveNode, VariableDefinitionNode } from '../language/as */ export function getVariableValues( schema: GraphQLSchema, - varDefNodes: Array, + varDefNodes: VariableDefinitionNode[], inputs: { [key: string]: any } -): { [key: string]: any } +): { [key: string]: any }; /** * Prepares an object map of argument values given a list of argument diff --git a/types/graphql/graphql-tests.ts b/types/graphql/graphql-tests.ts index 58725259e7..7c0210249b 100644 --- a/types/graphql/graphql-tests.ts +++ b/types/graphql/graphql-tests.ts @@ -3,180 +3,180 @@ import * as graphql from 'graphql'; /////////////////////////// // graphql // /////////////////////////// -namespace graphql_tests { +function graphql_tests() { // TODO } /////////////////////////// // graphql/language // /////////////////////////// -namespace language_ast_tests { - // TODOS +function language_ast_tests() { + // TODO } -namespace language_index_tests { - // TODOS +function language_index_tests() { + // TODO } -namespace language_kinds_tests { - // TODOS +function language_kinds_tests() { + // TODO } -namespace language_lexer_tests { - // TODOS +function language_lexer_tests() { + // TODO } -namespace language_location_tests { - // TODOS +function language_location_tests() { + // TODO } -namespace language_parser_tests { - // TODOS +function language_parser_tests() { + // TODO } -namespace language_printer_tests { - // TODOS +function language_printer_tests() { + // TODO } -namespace language_source_tests { - // TODOS +function language_source_tests() { + // TODO } -namespace language_visitor_tests { - // TODOS +function language_visitor_tests() { + // TODO } /////////////////////////// // graphql/type // /////////////////////////// -namespace type_definition_tests { +function type_definition_tests() { // TODO } -namespace type_directives_tests { +function type_directives_tests() { // TODO } -namespace type_introspection_tests { +function type_introspection_tests() { // TODO } -namespace type_scalars_tests { +function type_scalars_tests() { // TODO } -namespace type_schema_tests { +function type_schema_tests() { // TODO } /////////////////////////// // graphql/validation // /////////////////////////// -namespace validation_specifiedRules_tests { - +function validation_specifiedRules_tests() { + // TODO } -namespace validation_validate_tests { - +function validation_validate_tests() { + // TODO } /////////////////////////// // graphql/execution // /////////////////////////// -namespace execution_execute_tests { +function execution_execute_tests() { // TODOS } -namespace execution_values_tests { +function execution_values_tests() { // TODOS } /////////////////////////// // graphql/error // /////////////////////////// -namespace error_GraphQLError { - +function error_GraphQLError() { + // TODOS } -namespace error_formatError { - +function error_formatError() { + // TODOS } -namespace error_locatedError { - +function error_locatedError() { + // TODOS } -namespace error_syntaxError { - +function error_syntaxError() { + // TODOS } /////////////////////////// // graphql/utilities // /////////////////////////// -namespace utilities_TypeInfo_tests { - //TODOS +function utilities_TypeInfo_tests() { + // TODOS } -namespace utilities_assertValidName_tests { - //TODOS +function utilities_assertValidName_tests() { + // TODOS } -namespace utilities_astFromValue_tests { - //TODOS +function utilities_astFromValue_tests() { + // TODOS } -namespace utilities_buildASTSchema_tests { - //TODOS +function utilities_buildASTSchema_tests() { + // TODOS } -namespace utilities_buildClientSchema_tests { - //TODOS +function utilities_buildClientSchema_tests() { + // TODOS } -namespace utilities_concatAST_tests { - //TODOS +function utilities_concatAST_tests() { + // TODOS } -namespace utilities_extendSchema_tests { - //TODOS +function utilities_extendSchema_tests() { + // TODOS } -namespace utilities_getOperationAST_tests { - //TODOS +function utilities_getOperationAST_tests() { + // TODOS } -namespace utilities_index_tests { - //TODOS +function utilities_index_tests() { + // TODOS } -namespace utilities_introspectionQuery_tests { - //TODOS +function utilities_introspectionQuery_tests() { + // TODOS } -namespace utilities_isValidJSValue_tests { - //TODOS +function utilities_isValidJSValue_tests() { + // TODOS } -namespace utilities_isValidLiteralValue_tests { - //TODOS +function utilities_isValidLiteralValue_tests() { + // TODOS } -namespace utilities_schemaPrinter_tests { - //TODOS +function utilities_schemaPrinter_tests() { + // TODOS } -namespace utilities_separateOperations_tests { - //TODOS +function utilities_separateOperations_tests() { + // TODOS } -namespace utilities_typeComparators_tests { - //TODOS +function utilities_typeComparators_tests() { + // TODOS } -namespace utilities_typeFromAST_tests { - //TODOS +function utilities_typeFromAST_tests() { + // TODOS } -namespace utilities_valueFromAST_tests { - //TODOS +function utilities_valueFromAST_tests() { + // TODOS } diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index fbd724ff4a..d4cf14b42f 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -1,6 +1,10 @@ // Type definitions for graphql 0.10 // Project: https://www.npmjs.com/package/graphql -// Definitions by: TonyYang , Caleb Meredith , Dominic Watson , Firede , Kepennar +// Definitions by: TonyYang +// Caleb Meredith +// Dominic Watson +// Firede +// Kepennar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -9,12 +13,9 @@ export { graphql } from './graphql'; -/// - // Create and operate on GraphQL type definitions and schema. export * from './type'; - // Parse and operate on GraphQL language source files. export * from './language'; @@ -28,7 +29,6 @@ export { ExecutionResult, } from './execution'; - // Validate GraphQL queries. export { validate, @@ -36,7 +36,6 @@ export { specifiedRules, } from './validation'; - // Create and format GraphQL errors. export { GraphQLError, @@ -45,7 +44,6 @@ export { GraphQLErrorLocation, } from './error'; - // Utilities for operating on GraphQL type schema and parsed sources. export { // The GraphQL query recommended for a full schema introspection. diff --git a/types/graphql/language/ast.d.ts b/types/graphql/language/ast.d.ts index d0f25b65d0..f4bc343ed2 100644 --- a/types/graphql/language/ast.d.ts +++ b/types/graphql/language/ast.d.ts @@ -4,8 +4,7 @@ import { Source } from './source'; * Contains a range of UTF-8 character offsets and token references that * identify the region of the source from which the AST derived. */ -export type Location = { - +export interface Location { /** * The character offset at which this Node begins. */ @@ -30,37 +29,37 @@ export type Location = { * The Source document the AST represents. */ source: Source; -}; +} /** * Represents a range of characters represented by a lexical token * within a Source. */ -export type Token = { - +export interface Token { /** * The kind of Token. */ - kind: '' - | '' - | '!' - | '$' - | '(' - | ')' - | '...' - | ':' - | '=' - | '@' - | '[' - | ']' - | '{' - | '|' - | '}' - | 'Name' - | 'Int' - | 'Float' - | 'String' - | 'Comment'; + kind: + | '' + | '' + | '!' + | '$' + | '(' + | ')' + | '...' + | ':' + | '=' + | '@' + | '[' + | ']' + | '{' + | '|' + | '}' + | 'Name' + | 'Int' + | 'Float' + | 'String' + | 'Comment'; /** * The character offset at which this Node begins. @@ -94,12 +93,13 @@ export type Token = { */ prev?: Token; next?: Token; -}; +} /** * The list of all possible AST node types. */ -export type ASTNode = NameNode +export type ASTNode = + | NameNode | DocumentNode | OperationDefinitionNode | VariableDefinitionNode @@ -139,7 +139,7 @@ export type ASTNode = NameNode // Name -export type NameNode = { +export interface NameNode { kind: 'Name'; loc?: Location; value: string; @@ -147,30 +147,31 @@ export type NameNode = { // Document -export type DocumentNode = { +export interface DocumentNode { kind: 'Document'; loc?: Location; - definitions: Array; + definitions: DefinitionNode[]; } -export type DefinitionNode = OperationDefinitionNode +export type DefinitionNode = + | OperationDefinitionNode | FragmentDefinitionNode - | TypeSystemDefinitionNode // experimental non-spec addition. + | TypeSystemDefinitionNode; // experimental non-spec addition. -export type OperationDefinitionNode = { +export interface OperationDefinitionNode { kind: 'OperationDefinition'; loc?: Location; operation: OperationTypeNode; name?: NameNode; - variableDefinitions?: Array; - directives?: Array; + variableDefinitions?: VariableDefinitionNode[]; + directives?: DirectiveNode[]; selectionSet: SelectionSetNode; } // Note: subscription is an experimental non-spec addition. export type OperationTypeNode = 'query' | 'mutation' | 'subscription'; -export type VariableDefinitionNode = { +export interface VariableDefinitionNode { kind: 'VariableDefinition'; loc?: Location; variable: VariableNode; @@ -178,70 +179,70 @@ export type VariableDefinitionNode = { defaultValue?: ValueNode; } -export type VariableNode = { +export interface VariableNode { kind: 'Variable'; loc?: Location; name: NameNode; } -export type SelectionSetNode = { +export interface SelectionSetNode { kind: 'SelectionSet'; loc?: Location; - selections: Array; + selections: SelectionNode[]; } -export type SelectionNode = FieldNode +export type SelectionNode = + | FieldNode | FragmentSpreadNode - | InlineFragmentNode + | InlineFragmentNode; -export type FieldNode = { +export interface FieldNode { kind: 'Field'; loc?: Location; alias?: NameNode; name: NameNode; - arguments?: Array; - directives?: Array; + arguments?: ArgumentNode[]; + directives?: DirectiveNode[]; selectionSet?: SelectionSetNode; } -export type ArgumentNode = { +export interface ArgumentNode { kind: 'Argument'; loc?: Location; name: NameNode; value: ValueNode; } - // Fragments -export type FragmentSpreadNode = { +export interface FragmentSpreadNode { kind: 'FragmentSpread'; loc?: Location; name: NameNode; - directives?: Array; + directives?: DirectiveNode[]; } -export type InlineFragmentNode = { +export interface InlineFragmentNode { kind: 'InlineFragment'; loc?: Location; typeCondition?: NamedTypeNode; - directives?: Array; + directives?: DirectiveNode[]; selectionSet: SelectionSetNode; } -export type FragmentDefinitionNode = { +export interface FragmentDefinitionNode { kind: 'FragmentDefinition'; loc?: Location; name: NameNode; typeCondition: NamedTypeNode; - directives?: Array; + directives?: DirectiveNode[]; selectionSet: SelectionSetNode; } - // Values -export type ValueNode = VariableNode +export type ValueNode = + | VariableNode | IntValueNode | FloatValueNode | StringValueNode @@ -249,92 +250,91 @@ export type ValueNode = VariableNode | NullValueNode | EnumValueNode | ListValueNode - | ObjectValueNode + | ObjectValueNode; -export type IntValueNode = { +export interface IntValueNode { kind: 'IntValue'; loc?: Location; value: string; } -export type FloatValueNode = { +export interface FloatValueNode { kind: 'FloatValue'; loc?: Location; value: string; } -export type StringValueNode = { +export interface StringValueNode { kind: 'StringValue'; loc?: Location; value: string; } -export type BooleanValueNode = { +export interface BooleanValueNode { kind: 'BooleanValue'; loc?: Location; value: boolean; } -export type NullValueNode = { +export interface NullValueNode { kind: 'NullValue'; loc?: Location; } -export type EnumValueNode = { +export interface EnumValueNode { kind: 'EnumValue'; loc?: Location; value: string; } -export type ListValueNode = { +export interface ListValueNode { kind: 'ListValue'; loc?: Location; - values: Array; + values: ValueNode[]; } -export type ObjectValueNode = { +export interface ObjectValueNode { kind: 'ObjectValue'; loc?: Location; - fields: Array; + fields: ObjectFieldNode[]; } -export type ObjectFieldNode = { +export interface ObjectFieldNode { kind: 'ObjectField'; loc?: Location; name: NameNode; value: ValueNode; } - // Directives -export type DirectiveNode = { +export interface DirectiveNode { kind: 'Directive'; loc?: Location; name: NameNode; - arguments?: Array; + arguments?: ArgumentNode[]; } - // Type Reference -export type TypeNode = NamedTypeNode +export type TypeNode = + | NamedTypeNode | ListTypeNode - | NonNullTypeNode + | NonNullTypeNode; -export type NamedTypeNode = { +export interface NamedTypeNode { kind: 'NamedType'; loc?: Location; name: NameNode; -}; +} -export type ListTypeNode = { +export interface ListTypeNode { kind: 'ListType'; loc?: Location; type: TypeNode; } -export type NonNullTypeNode = { +export interface NonNullTypeNode { kind: 'NonNullType'; loc?: Location; type: NamedTypeNode | ListTypeNode; @@ -342,115 +342,117 @@ export type NonNullTypeNode = { // Type System Definition -export type TypeSystemDefinitionNode = SchemaDefinitionNode +export type TypeSystemDefinitionNode = + | SchemaDefinitionNode | TypeDefinitionNode | TypeExtensionDefinitionNode - | DirectiveDefinitionNode + | DirectiveDefinitionNode; -export type SchemaDefinitionNode = { +export interface SchemaDefinitionNode { kind: 'SchemaDefinition'; loc?: Location; - directives: Array; - operationTypes: Array; + directives: DirectiveNode[]; + operationTypes: OperationTypeDefinitionNode[]; } -export type OperationTypeDefinitionNode = { +export interface OperationTypeDefinitionNode { kind: 'OperationTypeDefinition'; loc?: Location; operation: OperationTypeNode; type: NamedTypeNode; } -export type TypeDefinitionNode = ScalarTypeDefinitionNode +export type TypeDefinitionNode = + | ScalarTypeDefinitionNode | ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode | UnionTypeDefinitionNode | EnumTypeDefinitionNode - | InputObjectTypeDefinitionNode + | InputObjectTypeDefinitionNode; -export type ScalarTypeDefinitionNode = { +export interface ScalarTypeDefinitionNode { kind: 'ScalarTypeDefinition'; loc?: Location; name: NameNode; - directives?: Array; + directives?: DirectiveNode[]; } -export type ObjectTypeDefinitionNode = { +export interface ObjectTypeDefinitionNode { kind: 'ObjectTypeDefinition'; loc?: Location; name: NameNode; - interfaces?: Array; - directives?: Array; - fields: Array; + interfaces?: NamedTypeNode[]; + directives?: DirectiveNode[]; + fields: FieldDefinitionNode[]; } -export type FieldDefinitionNode = { +export interface FieldDefinitionNode { kind: 'FieldDefinition'; loc?: Location; name: NameNode; - arguments: Array; + arguments: InputValueDefinitionNode[]; type: TypeNode; - directives?: Array; + directives?: DirectiveNode[]; } -export type InputValueDefinitionNode = { +export interface InputValueDefinitionNode { kind: 'InputValueDefinition'; loc?: Location; name: NameNode; type: TypeNode; defaultValue?: ValueNode; - directives?: Array; + directives?: DirectiveNode[]; } -export type InterfaceTypeDefinitionNode = { +export interface InterfaceTypeDefinitionNode { kind: 'InterfaceTypeDefinition'; loc?: Location; name: NameNode; - directives?: Array; - fields: Array; + directives?: DirectiveNode[]; + fields: FieldDefinitionNode[]; } -export type UnionTypeDefinitionNode = { +export interface UnionTypeDefinitionNode { kind: 'UnionTypeDefinition'; loc?: Location; name: NameNode; - directives?: Array; - types: Array; + directives?: DirectiveNode[]; + types: NamedTypeNode[]; } -export type EnumTypeDefinitionNode = { +export interface EnumTypeDefinitionNode { kind: 'EnumTypeDefinition'; loc?: Location; name: NameNode; - directives?: Array; - values: Array; + directives?: DirectiveNode[]; + values: EnumValueDefinitionNode[]; } -export type EnumValueDefinitionNode = { +export interface EnumValueDefinitionNode { kind: 'EnumValueDefinition'; loc?: Location; name: NameNode; - directives?: Array; + directives?: DirectiveNode[]; } -export type InputObjectTypeDefinitionNode = { +export interface InputObjectTypeDefinitionNode { kind: 'InputObjectTypeDefinition'; loc?: Location; name: NameNode; - directives?: Array; - fields: Array; + directives?: DirectiveNode[]; + fields: InputValueDefinitionNode[]; } -export type TypeExtensionDefinitionNode = { +export interface TypeExtensionDefinitionNode { kind: 'TypeExtensionDefinition'; loc?: Location; definition: ObjectTypeDefinitionNode; } -export type DirectiveDefinitionNode = { +export interface DirectiveDefinitionNode { kind: 'DirectiveDefinition'; loc?: Location; name: NameNode; - arguments?: Array; - locations: Array; + arguments?: InputValueDefinitionNode[]; + locations: NameNode[]; } diff --git a/types/graphql/language/kinds.d.ts b/types/graphql/language/kinds.d.ts index 3b595beb65..626d350818 100644 --- a/types/graphql/language/kinds.d.ts +++ b/types/graphql/language/kinds.d.ts @@ -63,4 +63,4 @@ export const TYPE_EXTENSION_DEFINITION: 'TypeExtensionDefinition'; // Directive Definitions -export const DIRECTIVE_DEFINITION: 'DirectiveDefinition'; \ No newline at end of file +export const DIRECTIVE_DEFINITION: 'DirectiveDefinition'; diff --git a/types/graphql/language/lexer.d.ts b/types/graphql/language/lexer.d.ts index 5175b5b1e6..4a55f03dc2 100644 --- a/types/graphql/language/lexer.d.ts +++ b/types/graphql/language/lexer.d.ts @@ -18,7 +18,7 @@ export function createLexer( /** * The return type of createLexer. */ -export type Lexer = { +export interface Lexer { source: Source; options: TOptions; @@ -46,7 +46,7 @@ export type Lexer = { * Advances the token stream to the next non-ignored token. */ advance(): Token; -}; +} /** * An exported enum describing the different kinds of tokens that the diff --git a/types/graphql/language/location.d.ts b/types/graphql/language/location.d.ts index 8c638a3a96..4d7a13e314 100644 --- a/types/graphql/language/location.d.ts +++ b/types/graphql/language/location.d.ts @@ -1,6 +1,5 @@ import { Source } from "./source"; - export interface SourceLocation { line: number; column: number; diff --git a/types/graphql/language/parser.d.ts b/types/graphql/language/parser.d.ts index 1458d6736d..5aa195ddd4 100644 --- a/types/graphql/language/parser.d.ts +++ b/types/graphql/language/parser.d.ts @@ -5,14 +5,14 @@ import { Lexer } from "./lexer"; /** * Configuration options to control parser behavior */ -export type ParseOptions = { +export interface ParseOptions { /** * By default, the parser creates AST nodes that know the location * in the source that they correspond to. This configuration flag * disables that behavior for performance or testing. */ - noLocation?: boolean -}; + noLocation?: boolean; +} /** * Given a GraphQL source, parses it into a Document. diff --git a/types/graphql/language/visitor.d.ts b/types/graphql/language/visitor.d.ts index d4c528501e..024b292ed6 100644 --- a/types/graphql/language/visitor.d.ts +++ b/types/graphql/language/visitor.d.ts @@ -38,7 +38,7 @@ export const QueryDocumentKeys: { EnumValueDefinition: string[]; InputObjectTypeDefinition: string[]; TypeExtensionDefinition: string[]; -} +}; export const BREAK: any; diff --git a/types/graphql/tslint.json b/types/graphql/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/graphql/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/graphql/type/definition.d.ts b/types/graphql/type/definition.d.ts index eb64172f40..5b0a2e9181 100644 --- a/types/graphql/type/definition.d.ts +++ b/types/graphql/type/definition.d.ts @@ -10,14 +10,14 @@ import { GraphQLSchema } from './schema'; * These are all of the possible kinds of types. */ export type GraphQLType = - GraphQLScalarType | - GraphQLObjectType | - GraphQLInterfaceType | - GraphQLUnionType | - GraphQLEnumType | - GraphQLInputObjectType | - GraphQLList | - GraphQLNonNull; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull; export function isType(type: any): type is GraphQLType; @@ -27,16 +27,15 @@ export function assertType(type: any): GraphQLType; * These types may be used as input types for arguments and directives. */ export type GraphQLInputType = - GraphQLScalarType | - GraphQLEnumType | - GraphQLInputObjectType | - GraphQLList | - GraphQLNonNull< - GraphQLScalarType | - GraphQLEnumType | - GraphQLInputObjectType | - GraphQLList - >; + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList>; export function isInputType(type: GraphQLType): type is GraphQLInputType; @@ -46,20 +45,19 @@ export function assertInputType(type: GraphQLType): GraphQLInputType; * These types may be used as output types as the result of fields. */ export type GraphQLOutputType = - GraphQLScalarType | - GraphQLObjectType | - GraphQLInterfaceType | - GraphQLUnionType | - GraphQLEnumType | - GraphQLList | - GraphQLNonNull< - GraphQLScalarType | - GraphQLObjectType | - GraphQLInterfaceType | - GraphQLUnionType | - GraphQLEnumType | - GraphQLList - >; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList>; export function isOutputType(type: GraphQLType): type is GraphQLOutputType; @@ -69,8 +67,8 @@ export function assertOutputType(type: GraphQLType): GraphQLOutputType; * These types may describe types which may be leaf values. */ export type GraphQLLeafType = - GraphQLScalarType | - GraphQLEnumType; + | GraphQLScalarType + | GraphQLEnumType; export function isLeafType(type: GraphQLType): type is GraphQLLeafType; @@ -80,9 +78,9 @@ export function assertLeafType(type: GraphQLType): GraphQLLeafType; * These types may describe the parent context of a selection set. */ export type GraphQLCompositeType = - GraphQLObjectType | - GraphQLInterfaceType | - GraphQLUnionType; + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType; export function isCompositeType(type: GraphQLType): type is GraphQLCompositeType; @@ -92,8 +90,8 @@ export function assertCompositeType(type: GraphQLType): GraphQLCompositeType; * These types may describe the parent context of a selection set. */ export type GraphQLAbstractType = - GraphQLInterfaceType | - GraphQLUnionType; + | GraphQLInterfaceType + | GraphQLUnionType; export function isAbstractType(type: GraphQLType): type is GraphQLAbstractType; @@ -103,13 +101,13 @@ export function assertAbstractType(type: GraphQLType): GraphQLAbstractType; * These types can all accept null as a value. */ export type GraphQLNullableType = - GraphQLScalarType | - GraphQLObjectType | - GraphQLInterfaceType | - GraphQLUnionType | - GraphQLEnumType | - GraphQLInputObjectType | - GraphQLList; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList; export function getNullableType( type: T @@ -119,12 +117,12 @@ export function getNullableType( * These named types do not include modifiers like List or NonNull. */ export type GraphQLNamedType = - GraphQLScalarType | - GraphQLObjectType | - GraphQLInterfaceType | - GraphQLUnionType | - GraphQLEnumType | - GraphQLInputObjectType; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType; export function isNamedType(type: GraphQLType): boolean; @@ -175,9 +173,9 @@ export class GraphQLScalarType { export interface GraphQLScalarTypeConfig { name: string; description?: string; - serialize: (value: any) => TExternal | null | undefined; - parseValue?: (value: any) => TInternal | null | undefined; - parseLiteral?: (valueNode: ValueNode) => TInternal | null | undefined; + serialize(value: any): TExternal | null | undefined; + parseValue?(value: any): TInternal | null | undefined; + parseLiteral?(valueNode: ValueNode): TInternal | null | undefined; } /** @@ -224,17 +222,16 @@ export class GraphQLObjectType { constructor(config: GraphQLObjectTypeConfig); getFields(): GraphQLFieldMap; - getInterfaces(): Array; + getInterfaces(): GraphQLInterfaceType[]; toString(): string; } - export interface GraphQLObjectTypeConfig { name: string; - interfaces?: Thunk>; + interfaces?: Thunk; fields: Thunk>; isTypeOf?: GraphQLIsTypeOfFn; - description?: string + description?: string; } export type GraphQLTypeResolver = ( @@ -258,7 +255,7 @@ export type GraphQLFieldResolver = ( export interface GraphQLResolveInfo { fieldName: string; - fieldNodes: Array; + fieldNodes: FieldNode[]; returnType: GraphQLOutputType; parentType: GraphQLCompositeType; path: ResponsePath; @@ -297,7 +294,7 @@ export interface GraphQLField { name: string; description: string; type: GraphQLOutputType; - args: Array; + args: GraphQLArgument[]; resolve?: GraphQLFieldResolver; isDeprecated?: boolean; deprecationReason?: string; @@ -345,15 +342,15 @@ export class GraphQLInterfaceType { } export interface GraphQLInterfaceTypeConfig { - name: string, - fields: Thunk>, + name: string; + fields: Thunk>; /** * Optionally provide a custom type resolver function. If one is not provided, * the default implementation will call `isTypeOf` on each implementing * Object type. */ - resolveType?: GraphQLTypeResolver, - description?: string + resolveType?: GraphQLTypeResolver; + description?: string; } /** @@ -386,14 +383,14 @@ export class GraphQLUnionType { constructor(config: GraphQLUnionTypeConfig); - getTypes(): Array; + getTypes(): GraphQLObjectType[]; toString(): string; } export interface GraphQLUnionTypeConfig { - name: string, - types: Thunk>, + name: string; + types: Thunk; /** * Optionally provide a custom type resolver function. If one is not provided, * the default implementation will call `isTypeOf` on each implementing @@ -429,7 +426,7 @@ export class GraphQLEnumType { description: string; constructor(config: GraphQLEnumTypeConfig); - getValues(): Array; + getValues(): GraphQLEnumValue[]; getValue(name: string): GraphQLEnumValue; serialize(value: any): string; parseValue(value: any): any; diff --git a/types/graphql/type/directives.d.ts b/types/graphql/type/directives.d.ts index 5e470ddfca..aed6234ef5 100644 --- a/types/graphql/type/directives.d.ts +++ b/types/graphql/type/directives.d.ts @@ -3,7 +3,6 @@ import { GraphQLArgument } from './definition'; - export const DirectiveLocation: { // Operations QUERY: 'QUERY', @@ -27,7 +26,7 @@ export const DirectiveLocation: { INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION', }; -export type DirectiveLocationEnum = any //$Keys +export type DirectiveLocationEnum = keyof typeof DirectiveLocation; /** * Directives are used by the GraphQL runtime as a way of modifying execution @@ -36,8 +35,8 @@ export type DirectiveLocationEnum = any //$Keys export class GraphQLDirective { name: string; description: string; - locations: Array; - args: Array; + locations: DirectiveLocationEnum[]; + args: GraphQLArgument[]; constructor(config: GraphQLDirectiveConfig); } @@ -45,7 +44,7 @@ export class GraphQLDirective { export interface GraphQLDirectiveConfig { name: string; description?: string; - locations: Array; + locations: DirectiveLocationEnum[]; args?: GraphQLFieldConfigArgumentMap; } @@ -72,4 +71,4 @@ export const GraphQLDeprecatedDirective: GraphQLDirective; /** * The full list of specified directives. */ -export const specifiedDirectives: Array; +export const specifiedDirectives: GraphQLDirective[]; diff --git a/types/graphql/type/introspection.d.ts b/types/graphql/type/introspection.d.ts index 0227328b1d..989e34a882 100644 --- a/types/graphql/type/introspection.d.ts +++ b/types/graphql/type/introspection.d.ts @@ -10,7 +10,6 @@ import { } from './definition'; import { GraphQLField } from './definition'; - export const __Schema: GraphQLObjectType; export const __Directive: GraphQLObjectType; export const __DirectiveLocation: GraphQLEnumType; @@ -28,7 +27,7 @@ export const TypeKind: { INPUT_OBJECT: 'INPUT_OBJECT', LIST: 'LIST', NON_NULL: 'NON_NULL', -} +}; export const __TypeKind: GraphQLEnumType; diff --git a/types/graphql/type/scalars.d.ts b/types/graphql/type/scalars.d.ts index 6c01256643..31a33aafad 100644 --- a/types/graphql/type/scalars.d.ts +++ b/types/graphql/type/scalars.d.ts @@ -1,6 +1,5 @@ import { GraphQLScalarType } from './definition'; - export const GraphQLInt: GraphQLScalarType; export const GraphQLFloat: GraphQLScalarType; export const GraphQLString: GraphQLScalarType; diff --git a/types/graphql/type/schema.d.ts b/types/graphql/type/schema.d.ts index 01bd3b1ca5..2d0c5c7f3d 100644 --- a/types/graphql/type/schema.d.ts +++ b/types/graphql/type/schema.d.ts @@ -10,7 +10,6 @@ import { GraphQLDirective, } from './directives'; - /** * Schema Definition * @@ -53,14 +52,14 @@ export class GraphQLSchema { getSubscriptionType(): GraphQLObjectType|null|undefined; getTypeMap(): { [typeName: string]: GraphQLNamedType }; getType(name: string): GraphQLType; - getPossibleTypes(abstractType: GraphQLAbstractType): Array; + getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[]; isPossibleType( abstractType: GraphQLAbstractType, possibleType: GraphQLObjectType ): boolean; - getDirectives(): Array; + getDirectives(): GraphQLDirective[]; getDirective(name: string): GraphQLDirective; } @@ -68,6 +67,6 @@ export interface GraphQLSchemaConfig { query: GraphQLObjectType; mutation?: GraphQLObjectType; subscription?: GraphQLObjectType; - types?: Array; - directives?: Array; + types?: GraphQLNamedType[]; + directives?: GraphQLDirective[]; } diff --git a/types/graphql/utilities/TypeInfo.d.ts b/types/graphql/utilities/TypeInfo.d.ts index b4fa855569..98a53d37ef 100644 --- a/types/graphql/utilities/TypeInfo.d.ts +++ b/types/graphql/utilities/TypeInfo.d.ts @@ -36,10 +36,8 @@ export class TypeInfo { leave(node: ASTNode): any; } -export interface getFieldDef { - ( - schema: GraphQLSchema, - parentType: GraphQLType, - fieldNode: FieldNode - ): GraphQLField -} +export type getFieldDef = ( + schema: GraphQLSchema, + parentType: GraphQLType, + fieldNode: FieldNode, +) => GraphQLField; diff --git a/types/graphql/utilities/assertValidName.d.ts b/types/graphql/utilities/assertValidName.d.ts index 6104a26063..5ca2310a26 100644 --- a/types/graphql/utilities/assertValidName.d.ts +++ b/types/graphql/utilities/assertValidName.d.ts @@ -1,2 +1,2 @@ // Helper to assert that provided names are valid. -export function assertValidName(name: string): void; \ No newline at end of file +export function assertValidName(name: string): void; diff --git a/types/graphql/utilities/astFromValue.d.ts b/types/graphql/utilities/astFromValue.d.ts index 3d8ecdd0ec..44745c5e6c 100644 --- a/types/graphql/utilities/astFromValue.d.ts +++ b/types/graphql/utilities/astFromValue.d.ts @@ -1,12 +1,15 @@ import { ValueNode, - //IntValueNode, - //FloatValueNode, - //StringValueNode, - //BooleanValueNode, - //EnumValueNode, - //ListValueNode, - //ObjectValueNode, + /* + TODO: + IntValueNode, + FloatValueNode, + StringValueNode, + BooleanValueNode, + EnumValueNode, + ListValueNode, + ObjectValueNode, + */ } from '../language/ast'; import { GraphQLInputType } from '../type/definition'; @@ -30,4 +33,4 @@ import { GraphQLInputType } from '../type/definition'; export function astFromValue( value: any, type: GraphQLInputType -): ValueNode // Warning: there is a code in bottom: throw new TypeError +): ValueNode; // Warning: there is a code in bottom: throw new TypeError diff --git a/types/graphql/utilities/buildASTSchema.d.ts b/types/graphql/utilities/buildASTSchema.d.ts index 94f4e2a47a..b20c8fc856 100644 --- a/types/graphql/utilities/buildASTSchema.d.ts +++ b/types/graphql/utilities/buildASTSchema.d.ts @@ -2,7 +2,6 @@ import { DocumentNode, Location } from '../language/ast'; import { Source } from '../language/source'; import { GraphQLSchema } from '../type/schema'; - /** * This takes the ast of a schema document produced by the parse function in * src/language/parser.js. @@ -24,5 +23,5 @@ export function getDescription(node: { loc?: Location }): string; /** * A helper function to build a GraphQLSchema directly from a source * document. -*/ + */ export function buildSchema(source: string | Source): GraphQLSchema; diff --git a/types/graphql/utilities/buildClientSchema.d.ts b/types/graphql/utilities/buildClientSchema.d.ts index 391e651f52..166ec43cf7 100644 --- a/types/graphql/utilities/buildClientSchema.d.ts +++ b/types/graphql/utilities/buildClientSchema.d.ts @@ -1,7 +1,6 @@ import { IntrospectionQuery } from './introspectionQuery'; import { GraphQLSchema } from '../type/schema'; - /** * Build a GraphQLSchema for use by client tools. * diff --git a/types/graphql/utilities/concatAST.d.ts b/types/graphql/utilities/concatAST.d.ts index 1f6fcb985f..405ac69936 100644 --- a/types/graphql/utilities/concatAST.d.ts +++ b/types/graphql/utilities/concatAST.d.ts @@ -1,9 +1,8 @@ import { DocumentNode } from '../language/ast'; - /** * Provided a collection of ASTs, presumably each from different files, * concatenate the ASTs together into batched AST, useful for validating many * GraphQL source files which together represent one conceptual application. */ -export function concatAST(asts: Array): DocumentNode; +export function concatAST(asts: DocumentNode[]): DocumentNode; diff --git a/types/graphql/utilities/extendSchema.d.ts b/types/graphql/utilities/extendSchema.d.ts index 60b91e70b2..f7d00b2fee 100644 --- a/types/graphql/utilities/extendSchema.d.ts +++ b/types/graphql/utilities/extendSchema.d.ts @@ -1,7 +1,6 @@ import { DocumentNode } from '../language/ast'; import { GraphQLSchema } from '../type/schema'; - /** * Produces a new schema given an existing schema and a document which may * contain GraphQL type extensions and definitions. The original schema will diff --git a/types/graphql/utilities/findBreakingChanges.d.ts b/types/graphql/utilities/findBreakingChanges.d.ts index 94a74ced90..78d5a5a95b 100644 --- a/types/graphql/utilities/findBreakingChanges.d.ts +++ b/types/graphql/utilities/findBreakingChanges.d.ts @@ -10,7 +10,6 @@ import { } from '../type/definition'; import { GraphQLSchema } from '../type/schema'; - export const BreakingChangeType: { FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND', FIELD_REMOVED: 'FIELD_REMOVED', @@ -20,17 +19,18 @@ export const BreakingChangeType: { VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM', }; -export type BreakingChangeKey = 'FIELD_CHANGED_KIND' +export type BreakingChangeKey = + | 'FIELD_CHANGED_KIND' | 'FIELD_REMOVED' | 'TYPE_CHANGED_KIND' | 'TYPE_REMOVED' | 'TYPE_REMOVED_FROM_UNION' | 'VALUE_REMOVED_FROM_ENUM'; -export type BreakingChange = { +export interface BreakingChange { type: BreakingChangeKey; description: string; -}; +} /** * Given two schemas, returns an Array containing descriptions of all the types @@ -39,7 +39,7 @@ export type BreakingChange = { export function findBreakingChanges( oldSchema: GraphQLSchema, newSchema: GraphQLSchema -): Array +): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking @@ -48,7 +48,7 @@ export function findBreakingChanges( export function findRemovedTypes( oldSchema: GraphQLSchema, newSchema: GraphQLSchema -): Array +): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking @@ -57,7 +57,7 @@ export function findRemovedTypes( export function findTypesThatChangedKind( oldSchema: GraphQLSchema, newSchema: GraphQLSchema -): Array +): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking @@ -67,7 +67,7 @@ export function findTypesThatChangedKind( export function findFieldsThatChangedType( oldSchema: GraphQLSchema, newSchema: GraphQLSchema -): Array; +): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking @@ -76,7 +76,7 @@ export function findFieldsThatChangedType( export function findTypesRemovedFromUnions( oldSchema: GraphQLSchema, newSchema: GraphQLSchema -): Array; +): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking @@ -85,4 +85,4 @@ export function findTypesRemovedFromUnions( export function findValuesRemovedFromEnums( oldSchema: GraphQLSchema, newSchema: GraphQLSchema -): Array; +): BreakingChange[]; diff --git a/types/graphql/utilities/findDeprecatedUsages.d.ts b/types/graphql/utilities/findDeprecatedUsages.d.ts index 58e9ae1685..8f6ff48239 100644 --- a/types/graphql/utilities/findDeprecatedUsages.d.ts +++ b/types/graphql/utilities/findDeprecatedUsages.d.ts @@ -10,4 +10,4 @@ import { GraphQLError } from '../error/GraphQLError'; export function findDeprecatedUsages( schema: GraphQLSchema, ast: DocumentNode -): Array +): GraphQLError[]; diff --git a/types/graphql/utilities/introspectionQuery.d.ts b/types/graphql/utilities/introspectionQuery.d.ts index cb9f0267b6..a89c5c1fec 100644 --- a/types/graphql/utilities/introspectionQuery.d.ts +++ b/types/graphql/utilities/introspectionQuery.d.ts @@ -95,26 +95,25 @@ fragment TypeRef on __Type { */ export const introspectionQuery: string; - export interface IntrospectionQuery { - __schema: IntrospectionSchema + __schema: IntrospectionSchema; } export interface IntrospectionSchema { queryType: IntrospectionNamedTypeRef; mutationType?: IntrospectionNamedTypeRef; subscriptionType?: IntrospectionNamedTypeRef; - types: Array; - directives: Array; + types: IntrospectionType[]; + directives: IntrospectionDirective[]; } export type IntrospectionType = - IntrospectionScalarType | - IntrospectionObjectType | - IntrospectionInterfaceType | - IntrospectionUnionType | - IntrospectionEnumType | - IntrospectionInputObjectType; + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType + | IntrospectionInputObjectType; export interface IntrospectionScalarType { kind: 'SCALAR'; @@ -126,43 +125,43 @@ export interface IntrospectionObjectType { kind: 'OBJECT'; name: string; description?: string; - fields: Array; - interfaces: Array; + fields: IntrospectionField[]; + interfaces: IntrospectionNamedTypeRef[]; } export interface IntrospectionInterfaceType { kind: 'INTERFACE'; name: string; description?: string; - fields: Array; - possibleTypes: Array; + fields: IntrospectionField[]; + possibleTypes: IntrospectionNamedTypeRef[]; } export interface IntrospectionUnionType { kind: 'UNION'; name: string; description?: string; - possibleTypes: Array; + possibleTypes: IntrospectionNamedTypeRef[]; } export interface IntrospectionEnumType { kind: 'ENUM'; name: string; description?: string; - enumValues: Array; + enumValues: IntrospectionEnumValue[]; } export interface IntrospectionInputObjectType { kind: 'INPUT_OBJECT'; name: string; description?: string; - inputFields: Array; + inputFields: IntrospectionInputValue[]; } export type IntrospectionTypeRef = - IntrospectionNamedTypeRef | - IntrospectionListTypeRef | - IntrospectionNonNullTypeRef + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef; export interface IntrospectionNamedTypeRef { kind: string; @@ -182,7 +181,7 @@ export interface IntrospectionNonNullTypeRef { export interface IntrospectionField { name: string; description?: string; - args: Array; + args: IntrospectionInputValue[]; type: IntrospectionTypeRef; isDeprecated: boolean; deprecationReason?: string; @@ -205,6 +204,6 @@ export interface IntrospectionEnumValue { export interface IntrospectionDirective { name: string; description?: string; - locations: Array; - args: Array; + locations: DirectiveLocationEnum[]; + args: IntrospectionInputValue[]; } diff --git a/types/graphql/utilities/isValidJSValue.d.ts b/types/graphql/utilities/isValidJSValue.d.ts index a06706ec2c..cd11014579 100644 --- a/types/graphql/utilities/isValidJSValue.d.ts +++ b/types/graphql/utilities/isValidJSValue.d.ts @@ -8,4 +8,4 @@ import { GraphQLInputType } from '../type/definition'; export function isValidJSValue( value: any, type: GraphQLInputType -): Array +): string[]; diff --git a/types/graphql/utilities/isValidLiteralValue.d.ts b/types/graphql/utilities/isValidLiteralValue.d.ts index 71f7471a70..697c8eb97e 100644 --- a/types/graphql/utilities/isValidLiteralValue.d.ts +++ b/types/graphql/utilities/isValidLiteralValue.d.ts @@ -11,4 +11,4 @@ import { GraphQLInputType } from '../type/definition'; export function isValidLiteralValue( type: GraphQLInputType, valueNode: ValueNode -): Array +): string[]; diff --git a/types/graphql/utilities/separateOperations.d.ts b/types/graphql/utilities/separateOperations.d.ts index b5d9e7439a..4b4106df53 100644 --- a/types/graphql/utilities/separateOperations.d.ts +++ b/types/graphql/utilities/separateOperations.d.ts @@ -5,4 +5,4 @@ import { export function separateOperations( documentAST: DocumentNode -): { [operationName: string]: DocumentNode } +): { [operationName: string]: DocumentNode }; diff --git a/types/graphql/utilities/typeComparators.d.ts b/types/graphql/utilities/typeComparators.d.ts index f9442914d3..16e6acd680 100644 --- a/types/graphql/utilities/typeComparators.d.ts +++ b/types/graphql/utilities/typeComparators.d.ts @@ -7,7 +7,6 @@ import { GraphQLSchema } from '../type/schema'; - /** * Provided two types, return true if the types are equal (invariant). */ diff --git a/types/graphql/utilities/typeFromAST.d.ts b/types/graphql/utilities/typeFromAST.d.ts index ce1c8b061f..c3cacf90df 100644 --- a/types/graphql/utilities/typeFromAST.d.ts +++ b/types/graphql/utilities/typeFromAST.d.ts @@ -5,4 +5,4 @@ import { GraphQLSchema } from '../type/schema'; export function typeFromAST( schema: GraphQLSchema, typeNode: TypeNode -): GraphQLType +): GraphQLType; diff --git a/types/graphql/utilities/valueFromAST.d.ts b/types/graphql/utilities/valueFromAST.d.ts index a292e079ab..24dd435448 100644 --- a/types/graphql/utilities/valueFromAST.d.ts +++ b/types/graphql/utilities/valueFromAST.d.ts @@ -6,7 +6,6 @@ import { ObjectValueNode } from '../language/ast'; - export function valueFromAST( valueNode: ValueNode, type: GraphQLInputType, diff --git a/types/graphql/validation/validate.d.ts b/types/graphql/validation/validate.d.ts index 9f4a9afdad..a4b628777e 100644 --- a/types/graphql/validation/validate.d.ts +++ b/types/graphql/validation/validate.d.ts @@ -19,9 +19,6 @@ import { GraphQLDirective } from '../type/directives'; import { TypeInfo } from '../utilities/TypeInfo'; import { specifiedRules } from './specifiedRules'; - -//type ValidationRule = (context: ValidationContext) => any; - /** * Implements the "Validation" section of the spec. * @@ -38,8 +35,8 @@ import { specifiedRules } from './specifiedRules'; export function validate( schema: GraphQLSchema, ast: DocumentNode, - rules?: Array -): Array; + rules?: any[] +): GraphQLError[]; /** * This uses a specialized visitor which runs multiple visitors in parallel, @@ -51,13 +48,13 @@ export function visitUsingRules( schema: GraphQLSchema, typeInfo: TypeInfo, documentAST: DocumentNode, - rules: Array -): Array; + rules: any[] +): GraphQLError[]; export type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; export interface VariableUsage { - node: VariableNode, - type: GraphQLInputType + node: VariableNode; + type: GraphQLInputType; } /** @@ -69,7 +66,7 @@ export class ValidationContext { constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo); reportError(error: GraphQLError): void; - getErrors(): Array; + getErrors(): GraphQLError[]; getSchema(): GraphQLSchema; @@ -77,17 +74,17 @@ export class ValidationContext { getFragment(name: string): FragmentDefinitionNode; - getFragmentSpreads(node: SelectionSetNode): Array; + getFragmentSpreads(node: SelectionSetNode): FragmentSpreadNode[]; getRecursivelyReferencedFragments( operation: OperationDefinitionNode - ): Array; + ): FragmentDefinitionNode[]; - getVariableUsages(node: NodeWithSelectionSet): Array; + getVariableUsages(node: NodeWithSelectionSet): VariableUsage[]; getRecursiveVariableUsages( operation: OperationDefinitionNode - ): Array; + ): VariableUsage[]; getType(): GraphQLOutputType; @@ -100,4 +97,4 @@ export class ValidationContext { getDirective(): GraphQLDirective; getArgument(): GraphQLArgument; -} \ No newline at end of file +}