Skip to content

improve(types): readable result types #1477

improve(types): readable result types

improve(types): readable result types #1477

Triggered via pull request October 14, 2024 04:39
Status Failure
Total duration 1m 8s
Artifacts

pr.yml

on: pull_request
Matrix: test-examples
Matrix: test-unit
Fit to window
Zoom out
Zoom in

Annotations

17 errors and 3 warnings
src/layers/4_generator/generate.test.ts > schema2: src/layers/4_generator/generate.test.ts#L38
Error: Snapshot `schema2 11` mismatched - Expected + Received @@ -1,526 +1,639 @@ - "import type { InferResult } from '../../../../../../src/entrypoints/schema.js' + "import { Simplify } from 'type-fest' + import type { InferResult } from '../../../../../../src/entrypoints/schema.js' import type * as Utils from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSet from './SelectionSets.js' export interface MutationMethods<$Config extends Utils.Config> { // todo Use a static type here? $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Mutation>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - InferResult.Mutation< - Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Mutation', $SelectionSet>, - Index + Simplify< + Utils.ResolveOutputReturnRootType< + $Config, + Index, + InferResult.Mutation< + Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Mutation', $SelectionSet>, + Index + > > > > // todo Use a static type here? __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Mutation' + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + '__typename', + 'Mutation' + > > > id: <$SelectionSet>(selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Mutation.id>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'id', - InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['id'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + 'id', + InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['id'], Index> + > > > idNonNull: <$SelectionSet>(selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'idNonNull', - InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['idNonNull'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + 'idNonNull', + InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['idNonNull'], Index> + > > > } export interface QueryMethods<$Config extends Utils.Config> { // todo Use a static type here? $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - InferResult.Query< - Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Query', $SelectionSet>, - Index + Simplify< + Utils.ResolveOutputReturnRootType< + $Config, + Index, + InferResult.Query< + Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Query', $SelectionSet>, + Index + > > > > // todo Use a static type here? __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Query' + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + '__typename', + 'Query' + > > > InputObjectNested: <$SelectionSet>( selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested>, ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'InputObjectNested', - InferResult.Field<$SelectionSet, Index['Root']['Query']['fields']['InputObjectNested'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, +
test unit Node 20 @env jsdom
Process completed with exit code 1.
types: tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts#L1
'Simplify' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
types: tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts#L1
'Simplify' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
types: tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts#L1
'Simplify' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
types: tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts#L1
'Simplify' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
types
Process completed with exit code 2.
test unit Node 22 @env jsdom
The job was canceled because "_20_jsdom" failed.
src/layers/4_generator/generate.test.ts > schema2: src/layers/4_generator/generate.test.ts#L38
Error: Snapshot `schema2 11` mismatched - Expected + Received @@ -1,526 +1,639 @@ - "import type { InferResult } from '../../../../../../src/entrypoints/schema.js' + "import { Simplify } from 'type-fest' + import type { InferResult } from '../../../../../../src/entrypoints/schema.js' import type * as Utils from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSet from './SelectionSets.js' export interface MutationMethods<$Config extends Utils.Config> { // todo Use a static type here? $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Mutation>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - InferResult.Mutation< - Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Mutation', $SelectionSet>, - Index + Simplify< + Utils.ResolveOutputReturnRootType< + $Config, + Index, + InferResult.Mutation< + Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Mutation', $SelectionSet>, + Index + > > > > // todo Use a static type here? __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Mutation' + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + '__typename', + 'Mutation' + > > > id: <$SelectionSet>(selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Mutation.id>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'id', - InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['id'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + 'id', + InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['id'], Index> + > > > idNonNull: <$SelectionSet>(selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'idNonNull', - InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['idNonNull'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + 'idNonNull', + InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['idNonNull'], Index> + > > > } export interface QueryMethods<$Config extends Utils.Config> { // todo Use a static type here? $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - InferResult.Query< - Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Query', $SelectionSet>, - Index + Simplify< + Utils.ResolveOutputReturnRootType< + $Config, + Index, + InferResult.Query< + Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Query', $SelectionSet>, + Index + > > > > // todo Use a static type here? __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Query' + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + '__typename', + 'Query' + > > > InputObjectNested: <$SelectionSet>( selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested>, ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'InputObjectNested', - InferResult.Field<$SelectionSet, Index['Root']['Query']['fields']['InputObjectNested'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, +
test unit Node 22 @env jsdom
The operation was canceled.
test unit Node 20 @env node
The job was canceled because "_20_jsdom" failed.
src/layers/4_generator/generate.test.ts > schema2: src/layers/4_generator/generate.test.ts#L38
Error: Snapshot `schema2 11` mismatched - Expected + Received @@ -1,526 +1,639 @@ - "import type { InferResult } from '../../../../../../src/entrypoints/schema.js' + "import { Simplify } from 'type-fest' + import type { InferResult } from '../../../../../../src/entrypoints/schema.js' import type * as Utils from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSet from './SelectionSets.js' export interface MutationMethods<$Config extends Utils.Config> { // todo Use a static type here? $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Mutation>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - InferResult.Mutation< - Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Mutation', $SelectionSet>, - Index + Simplify< + Utils.ResolveOutputReturnRootType< + $Config, + Index, + InferResult.Mutation< + Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Mutation', $SelectionSet>, + Index + > > > > // todo Use a static type here? __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Mutation' + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + '__typename', + 'Mutation' + > > > id: <$SelectionSet>(selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Mutation.id>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'id', - InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['id'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + 'id', + InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['id'], Index> + > > > idNonNull: <$SelectionSet>(selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'idNonNull', - InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['idNonNull'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + 'idNonNull', + InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['idNonNull'], Index> + > > > } export interface QueryMethods<$Config extends Utils.Config> { // todo Use a static type here? $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - InferResult.Query< - Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Query', $SelectionSet>, - Index + Simplify< + Utils.ResolveOutputReturnRootType< + $Config, + Index, + InferResult.Query< + Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Query', $SelectionSet>, + Index + > > > > // todo Use a static type here? __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Query' + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + '__typename', + 'Query' + > > > InputObjectNested: <$SelectionSet>( selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested>, ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'InputObjectNested', - InferResult.Field<$SelectionSet, Index['Root']['Query']['fields']['InputObjectNested'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, +
test unit Node 20 @env node
The operation was canceled.
test unit Node 22 @env node
The job was canceled because "_20_jsdom" failed.
src/layers/4_generator/generate.test.ts > schema2: src/layers/4_generator/generate.test.ts#L38
Error: Snapshot `schema2 11` mismatched - Expected + Received @@ -1,526 +1,639 @@ - "import type { InferResult } from '../../../../../../src/entrypoints/schema.js' + "import { Simplify } from 'type-fest' + import type { InferResult } from '../../../../../../src/entrypoints/schema.js' import type * as Utils from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSet from './SelectionSets.js' export interface MutationMethods<$Config extends Utils.Config> { // todo Use a static type here? $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Mutation>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - InferResult.Mutation< - Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Mutation', $SelectionSet>, - Index + Simplify< + Utils.ResolveOutputReturnRootType< + $Config, + Index, + InferResult.Mutation< + Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Mutation', $SelectionSet>, + Index + > > > > // todo Use a static type here? __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Mutation' + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + '__typename', + 'Mutation' + > > > id: <$SelectionSet>(selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Mutation.id>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'id', - InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['id'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + 'id', + InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['id'], Index> + > > > idNonNull: <$SelectionSet>(selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'idNonNull', - InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['idNonNull'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + 'idNonNull', + InferResult.Field<$SelectionSet, Index['Root']['Mutation']['fields']['idNonNull'], Index> + > > > } export interface QueryMethods<$Config extends Utils.Config> { // todo Use a static type here? $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - InferResult.Query< - Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Query', $SelectionSet>, - Index + Simplify< + Utils.ResolveOutputReturnRootType< + $Config, + Index, + InferResult.Query< + Utils.AddTypenameToSelectedRootTypeResultFields<$Config, Index, 'Query', $SelectionSet>, + Index + > > > > // todo Use a static type here? __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Query' + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, + Index, + '__typename', + 'Query' + > > > InputObjectNested: <$SelectionSet>( selectionSet?: Utils.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested>, ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'InputObjectNested', - InferResult.Field<$SelectionSet, Index['Root']['Query']['fields']['InputObjectNested'], Index> + Simplify< + Utils.ResolveOutputReturnRootField< + $Config, +
test unit Node 22 @env node
The operation was canceled.
lint
Process completed with exit code 1.
lint: examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.ts#L52
Unnecessary optional chain on a non-nullish value
lint: src/layers/4_generator/config.ts#L213
Unnecessary conditional, value is always falsy