11import type { IncomingMessage , ServerResponse } from 'http' ;
22
33import type {
4- ASTVisitor ,
54 DocumentNode ,
65 ValidationRule ,
7- ValidationContext ,
86 ExecutionArgs ,
97 ExecutionResult ,
108 FormattedExecutionResult ,
@@ -15,7 +13,6 @@ import type {
1513} from 'graphql' ;
1614import accepts from 'accepts' ;
1715import httpError from 'http-errors' ;
18- import type { HttpError } from 'http-errors' ;
1916import {
2017 Source ,
2118 GraphQLError ,
@@ -78,7 +75,7 @@ export interface OptionsData {
7875 * An optional array of validation rules that will be applied on the document
7976 * in additional to those defined by the GraphQL spec.
8077 */
81- validationRules ?: ReadonlyArray < ( ctx : ValidationContext ) => ASTVisitor > ;
78+ validationRules ?: ReadonlyArray < ValidationRule > ;
8279
8380 /**
8481 * An optional function which will be used to validate instead of default `validate`
@@ -196,7 +193,7 @@ export function graphqlHTTP(options: Options): Middleware {
196193 // Higher scoped variables are referred to at various stages in the asynchronous state machine below.
197194 let params : GraphQLParams | undefined ;
198195 let showGraphiQL = false ;
199- let graphiqlOptions ;
196+ let graphiqlOptions : GraphiQLOptions | undefined ;
200197 let formatErrorFn = formatError ;
201198 let pretty = false ;
202199 let result : ExecutionResult ;
@@ -218,7 +215,7 @@ export function graphqlHTTP(options: Options): Middleware {
218215 }
219216
220217 // Then, resolve the Options to get OptionsData.
221- const optionsData : OptionsData = await resolveOptions ( params ) ;
218+ const optionsData = await resolveOptions ( params ) ;
222219
223220 // Collect information from the options data object.
224221 const schema = optionsData . schema ;
@@ -277,7 +274,7 @@ export function graphqlHTTP(options: Options): Middleware {
277274 }
278275
279276 // Parse source to AST, reporting any syntax error.
280- let documentAST ;
277+ let documentAST : DocumentNode ;
281278 try {
282279 documentAST = parseFn ( new Source ( query , 'GraphQL request' ) ) ;
283280 } catch ( syntaxError : unknown ) {
@@ -357,7 +354,7 @@ export function graphqlHTTP(options: Options): Middleware {
357354 }
358355 } catch ( rawError : unknown ) {
359356 // If an error was caught, report the httpError status, or 500.
360- const error : HttpError = httpError (
357+ const error = httpError (
361358 500 ,
362359 /* istanbul ignore next: Thrown by underlying library. */
363360 rawError instanceof Error ? rawError : String ( rawError ) ,
0 commit comments