From d989a76795d5c4385398d595d14db4f4a86d32e0 Mon Sep 17 00:00:00 2001 From: deathemperor Date: Tue, 30 Jan 2024 11:57:33 +0700 Subject: [PATCH] fix: increase tail-recursive conditional types from 50 to 1000 Co-authored-by: HaiNNT --- src/variables.ts | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/variables.ts b/src/variables.ts index e4e82e21..c6aae1da 100644 --- a/src/variables.ts +++ b/src/variables.ts @@ -3,17 +3,36 @@ import type { IntrospectionLikeType } from './introspection'; import type { DocumentNodeLike } from './parser'; import type { obj } from './utils'; -type getInputObjectTypeRec< +type _getInputObjectTypeRec< InputFields, Introspection extends IntrospectionLikeType, + ResultType, > = InputFields extends [infer InputField, ...infer Rest] - ? (InputField extends { name: any; type: any } - ? InputField['type'] extends { kind: 'NON_NULL' } - ? { [Name in InputField['name']]: unwrapType } - : { [Name in InputField['name']]?: unwrapType } - : {}) & - getInputObjectTypeRec - : {}; + ? _getInputObjectTypeRec< + Rest, + Introspection, + (InputField extends { + name: any; + type: any; + } + ? InputField['type'] extends { + kind: 'NON_NULL'; + } + ? { + [Name in InputField['name']]: unwrapType; + } + : { + [Name in InputField['name']]?: unwrapType; + } + : {}) & + ResultType + > + : ResultType; + +type getInputObjectTypeRec< + InputFields, + Introspection extends IntrospectionLikeType, +> = _getInputObjectTypeRec; type getScalarType< TypeName,