Skip to content

Commit 77ac82b

Browse files
committed
improve(types): use simplify for more readable result types
1 parent bfd427a commit 77ac82b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/layers/3_ResultSet/infer/root.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Simplify } from 'type-fest'
12
import { AssertIsEqual, type ExcludeNull, type GetKeyOr, type StringKeyof } from '../../../lib/prelude.js'
23
import type { TSError } from '../../../lib/TSError.js'
34
import type { Schema } from '../../1_Schema/__.js'
@@ -40,10 +41,10 @@ export type InferObject<$SelectionSet, $Schema extends SchemaIndex, $Node extend
4041
// todo what about when scalars wildcard is combined with other fields like relations?
4142
? InferSelectScalarsWildcard<$SelectionSet, $Schema,$Node>
4243
:
43-
(
44+
Simplify<(
4445
& InferSelectionNonSelectAlias<$SelectionSet, $Schema, $Node>
4546
& InferSelectionSelectAlias<$SelectionSet, $Schema, $Node>
46-
)
47+
)>
4748

4849
// dprint-ignore
4950
type InferSelectionNonSelectAlias<$SelectionSet , $Schema extends SchemaIndex, $Node extends Schema.Output.Object$2> =

src/layers/6_client/handleOutput.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ type IfConfiguredGetOutputErrorReturns<$Config extends Config> =
169169

170170
// dprint-ignore
171171
type IfConfiguredStripSchemaErrorsFromDataRootType<$Config extends Config, $Index extends SchemaIndex, $Data> =
172-
{ [$RootFieldName in keyof $Data]: IfConfiguredStripSchemaErrorsFromDataRootField<$Config, $Index, $Data[$RootFieldName]> }
172+
Simplify<{
173+
[$RootFieldName in keyof $Data]: IfConfiguredStripSchemaErrorsFromDataRootField<$Config, $Index, $Data[$RootFieldName]>
174+
}>
173175

174176
// dprint-ignore
175177
type IfConfiguredStripSchemaErrorsFromDataRootField<$Config extends Config, $Index extends SchemaIndex, $Data> =

0 commit comments

Comments
 (0)