Comparing version
# @gqlb/core | ||
## 0.0.7 | ||
### Patch Changes | ||
- 1cd50fb: Fixed intersection issue for output types | ||
## 0.0.6 | ||
@@ -4,0 +10,0 @@ |
@@ -17,5 +17,2 @@ import { Field, FragmentDefinition, FragmentDefinitionWithVariables as FragmentDefinitionWithVariables, InlineFragment, FragmentSpread, Operation } from "./runtime"; | ||
}>>; | ||
type ReadonlyMerge<A, B> = A extends Function ? never : { | ||
readonly [K in keyof A | keyof B]: K extends keyof A ? A[K] : K extends keyof B ? B[K] : never; | ||
}; | ||
export type BuildSelectionSet<T extends ReadonlyArray<SelectionSetSelection>, PT extends string, Acc = { | ||
@@ -26,5 +23,5 @@ readonly __typename: PT; | ||
...infer Tail extends ReadonlyArray<SelectionSetSelection> | ||
] ? Head extends Field ? BuildSelectionSet<Tail, PT, Acc & ResponseKeyObj<Head, SelectionOutput<Head>>> : Head extends FragmentSpread<infer F extends FragmentDefinition | FragmentDefinitionWithVariables> ? BuildSelectionSet<Tail, PT, ReadonlyMerge<Acc, FragmentOutput<F, PT>>> : Head extends InlineFragment ? BuildSelectionSet<Tail, PT, Acc & FragmentOutput<Head, PT>> : never : Acc; | ||
] ? Head extends Field ? BuildSelectionSet<Tail, PT, Acc & ResponseKeyObj<Head, SelectionOutput<Head>>> : Head extends FragmentSpread<infer F extends FragmentDefinition | FragmentDefinitionWithVariables> ? BuildSelectionSet<Tail, PT, Acc & FragmentOutput<F, PT>> : Head extends InlineFragment ? BuildSelectionSet<Tail, PT, Acc & FragmentOutput<Head, PT>> : never : Acc; | ||
export type SelectionSetOutput<T extends ReadonlyArray<SelectionSetSelection>, PossibleTypes extends string> = T extends Function ? never : PossibleTypes extends infer PT ? ReadonlyIntersectionCollapse<BuildSelectionSet<T, PT & string>> : never; | ||
export type OutputOf<T> = T extends Operation<infer Output> ? Output : T extends FragmentDefinitionWithVariables<any, any, any, infer Output> ? Output : T extends FragmentDefinition<any, any, any, infer Output> ? Output : SelectionOutput<T>; | ||
export type OutputOf<T> = T extends Operation<infer Output> ? Output : SelectionOutput<T>; | ||
export type VariablesOf<T> = T extends Operation<any, infer Variables> ? Variables : T extends FragmentDefinitionWithVariables<any, any, any, infer Variables> ? Variables : never; | ||
@@ -35,3 +32,2 @@ export declare const EnumValueSymbol: unique symbol; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=helpers.d.ts.map |
{ | ||
"name": "@gqlb/core", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -75,12 +75,2 @@ import { | ||
type ReadonlyMerge<A, B> = A extends Function | ||
? never | ||
: { | ||
readonly [K in keyof A | keyof B]: K extends keyof A | ||
? A[K] | ||
: K extends keyof B | ||
? B[K] | ||
: never; | ||
}; | ||
export type BuildSelectionSet< | ||
@@ -105,3 +95,3 @@ T extends ReadonlyArray<SelectionSetSelection>, | ||
> | ||
? BuildSelectionSet<Tail, PT, ReadonlyMerge<Acc, FragmentOutput<F, PT>>> | ||
? BuildSelectionSet<Tail, PT, Acc & FragmentOutput<F, PT>> | ||
: Head extends InlineFragment | ||
@@ -123,7 +113,3 @@ ? BuildSelectionSet<Tail, PT, Acc & FragmentOutput<Head, PT>> | ||
? Output | ||
: T extends FragmentDefinitionWithVariables<any, any, any, infer Output> | ||
? Output | ||
: T extends FragmentDefinition<any, any, any, infer Output> | ||
? Output | ||
: SelectionOutput<T>; | ||
: SelectionOutput<T>; | ||
@@ -130,0 +116,0 @@ export type VariablesOf<T> = T extends Operation<any, infer Variables> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
82034
-1.29%1738
-0.97%