Skip to content

Commit

Permalink
fix: increase tail-recursive conditional types from 50 to 1000
Browse files Browse the repository at this point in the history
Co-authored-by: HaiNNT <HaiNNT1302@gmail.com>
  • Loading branch information
deathemperor and HaiNNT committed Jan 30, 2024
1 parent 4dc30de commit d989a76
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions src/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<InputField['type'], Introspection> }
: { [Name in InputField['name']]?: unwrapType<InputField['type'], Introspection> }
: {}) &
getInputObjectTypeRec<Rest, Introspection>
: {};
? _getInputObjectTypeRec<
Rest,
Introspection,
(InputField extends {
name: any;
type: any;
}
? InputField['type'] extends {
kind: 'NON_NULL';
}
? {
[Name in InputField['name']]: unwrapType<InputField['type'], Introspection>;
}
: {
[Name in InputField['name']]?: unwrapType<InputField['type'], Introspection>;
}
: {}) &
ResultType
>
: ResultType;

type getInputObjectTypeRec<
InputFields,
Introspection extends IntrospectionLikeType,
> = _getInputObjectTypeRec<InputFields, Introspection, {}>;

type getScalarType<
TypeName,
Expand Down

0 comments on commit d989a76

Please sign in to comment.