Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase tail-recursive conditional types from 50 to 1000 for variables #46

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: increase tail-recursive conditional types from 50 to 1000
Co-authored-by: HaiNNT <HaiNNT1302@gmail.com>
  • Loading branch information
deathemperor and HaiNNT committed Jan 30, 2024
commit d989a76795d5c4385398d595d14db4f4a86d32e0
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