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

fix(document-builder): avoid "Excessive stack depth comparing types" #1307

Merged
merged 9 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default tsEslint.config({
'vitest*.config.ts',
'**/generated/**/*',
'tests/_/schemas/*/graffle/**/*',
'tests/e2e/github/graffle/**/*',
'**/tests/fixture/graffle/**/*',
'src/layers/1_Schema/Hybrid/types/Scalar/Scalar.ts', // There is an ESLint error that goes away when ignored leading to a circular issue of either lint error or unused lint disable.
'**/$/**/*',
Expand Down
15 changes: 10 additions & 5 deletions examples/$/graffle/modules/methods-document.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import type * as $$Utilities from 'graffle/utilities-for-generated'
import * as $$Schema from './schema.js'
import * as $$SelectionSets from './selection-sets.js'
import type * as $$Schema from './schema.js'
import type * as $$SelectionSets from './selection-sets.js'

export interface Document<$Context extends $$Utilities.Context> {
export interface Document<$Context> {
<$Document>(
document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context['scalars']>>,
document: $$Utilities.ExactNonEmpty<
$Document,
$$SelectionSets.$Document<
// @ts-expect-error Context constraint missing to avoid TS compare depth limit.
$Context['scalars']
>
>,
): $$Utilities.DocumentBuilder.DocumentRunner<
$Context,
$$Schema.Schema,
Expand All @@ -15,6 +21,5 @@ export interface Document<$Context extends $$Utilities.Context> {
}

export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction {
// @ts-expect-error parameter is Untyped.
return: Document<this['params']>
}
18 changes: 9 additions & 9 deletions examples/$/graffle/modules/methods-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
$Context,
() => Promise<
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
& $$Utilities.HandleOutputDocumentBuilderRootField<
$Context,
{ __typename: 'Query' },
'__typename'
Expand All @@ -36,7 +36,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.battles<$Context['scalars']>>,
) => Promise<
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
& $$Utilities.HandleOutputDocumentBuilderRootField<
$Context,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ battles: $SelectionSet },
Expand All @@ -53,7 +53,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.beings<$Context['scalars']>>,
) => Promise<
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
& $$Utilities.HandleOutputDocumentBuilderRootField<
$Context,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ beings: $SelectionSet },
Expand All @@ -70,7 +70,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemonByName<$Context['scalars']>>,
) => Promise<
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
& $$Utilities.HandleOutputDocumentBuilderRootField<
$Context,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ pokemonByName: $SelectionSet },
Expand All @@ -87,7 +87,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemons<$Context['scalars']>>,
) => Promise<
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
& $$Utilities.HandleOutputDocumentBuilderRootField<
$Context,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ pokemons: $SelectionSet },
Expand All @@ -104,7 +104,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainerByName<$Context['scalars']>>,
) => Promise<
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
& $$Utilities.HandleOutputDocumentBuilderRootField<
$Context,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ trainerByName: $SelectionSet },
Expand All @@ -121,7 +121,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainers<$Context['scalars']>>,
) => Promise<
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
& $$Utilities.HandleOutputDocumentBuilderRootField<
$Context,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ trainers: $SelectionSet },
Expand Down Expand Up @@ -153,7 +153,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> {
$Context,
() => Promise<
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
& $$Utilities.HandleOutputDocumentBuilderRootField<
$Context,
{ __typename: 'Mutation' },
'__typename'
Expand All @@ -167,7 +167,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> {
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.addPokemon<$Context['scalars']>>,
) => Promise<
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
& $$Utilities.HandleOutputDocumentBuilderRootField<
$Context,
$$Utilities.DocumentBuilder.InferResult.OperationMutation<
{ addPokemon: $SelectionSet },
Expand Down
Loading
Loading