From 7dfaef7c96486b2a8bc23df133e3484708224dab Mon Sep 17 00:00:00 2001 From: Rikki Schulte Date: Sun, 9 Aug 2020 23:58:53 -0400 Subject: [PATCH] improvement: server only LSP bugfix for config extensions (#1637) --- .../src/GraphQLLanguageService.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/graphql-language-service-interface/src/GraphQLLanguageService.ts b/packages/graphql-language-service-interface/src/GraphQLLanguageService.ts index cfa062cc454..fe64b8e2a7c 100644 --- a/packages/graphql-language-service-interface/src/GraphQLLanguageService.ts +++ b/packages/graphql-language-service-interface/src/GraphQLLanguageService.ts @@ -194,9 +194,11 @@ export class GraphQLLanguageService { // Check if there are custom validation rules to be used let customRules: ValidationRule[] | null = null; - const customValidationRules = extensions.customValidationRules; - if (customValidationRules) { - customRules = customValidationRules(this._graphQLConfig); + if ( + extensions?.customValidationRules && + typeof extensions.customValidationRules === 'function' + ) { + customRules = extensions.customValidationRules(this._graphQLConfig); /* eslint-enable no-implicit-coercion */ }