Skip to content

Commit

Permalink
Rename types in src/fragments for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Jan 10, 2024
1 parent 479105d commit c395f67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/fragments.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Kind } from '@0no-co/graphql.web';

type _FragmentMapContinue<Definitions> = Definitions extends readonly [
type _getFragmentMapRec<Definitions> = Definitions extends readonly [
infer Definition,
...infer Rest,
]
? (Definition extends { kind: Kind.FRAGMENT_DEFINITION; name: any }
? { [Name in Definition['name']['value']]: Definition }
: {}) &
_FragmentMapContinue<Rest>
_getFragmentMapRec<Rest>
: {};

export type FragmentMap<Document extends { kind: Kind.DOCUMENT; definitions: any[] }> =
_FragmentMapContinue<Document['definitions']>;
export type getFragmentMap<Document extends { kind: Kind.DOCUMENT; definitions: any[] }> =
_getFragmentMapRec<Document['definitions']>;
6 changes: 3 additions & 3 deletions src/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {

import type { tada } from './namespace';
import type { obj, objValues } from './utils';
import type { FragmentMap } from './fragments';
import type { getFragmentMap } from './fragments';

import type {
IntrospectionField,
Expand Down Expand Up @@ -223,7 +223,7 @@ type getDocumentType<
> = getDefinitionSelectionRec<
Document['definitions'],
Introspection,
FragmentMap<Document> & Fragments
getFragmentMap<Document> & Fragments
>;

type getFragmentType<
Expand All @@ -240,7 +240,7 @@ type getFragmentType<
Document['definitions'][0]['selectionSet']['selections'],
Introspection['types'][TypeName],
Introspection,
FragmentMap<Document> & Fragments
getFragmentMap<Document> & Fragments
>
: never
: never
Expand Down

0 comments on commit c395f67

Please sign in to comment.