Comparing version 0.0.7 to 0.0.8
# @gqlb/core | ||
## 0.0.8 | ||
### Patch Changes | ||
- 6874041: Fixed bug with deeply nested array intersection | ||
## 0.0.7 | ||
@@ -4,0 +10,0 @@ |
@@ -6,5 +6,5 @@ import { Field, FragmentDefinition, FragmentDefinitionWithVariables as FragmentDefinitionWithVariables, InlineFragment, FragmentSpread, Operation } from "./runtime"; | ||
}; | ||
export type ReadonlyIntersectionCollapse<T> = T extends Function ? never : { | ||
readonly [K in keyof T]: T[K]; | ||
}; | ||
type InterfaceCollapse<T> = T extends Record<string, any> ? { | ||
readonly [K in keyof T]: T[K] extends ReadonlyArray<Record<string, any>> ? readonly InterfaceCollapse<T[K][number]>[] : InterfaceCollapse<T[K]>; | ||
} : T extends ReadonlyArray<infer U> ? ReadonlyArray<InterfaceCollapse<U>> : T; | ||
export type SelectionOutput<T> = T extends Field<any, any, infer O> ? O : T extends InlineFragment<any, any, infer O> ? O : T extends FragmentDefinition<any, any, any, infer O> ? O : T extends FragmentDefinitionWithVariables<any, any, any, any, infer O> ? O : T extends FragmentSpread<infer F> ? SelectionOutput<F> : never; | ||
@@ -24,3 +24,3 @@ export type SelectionSetSelection<PossibleTypes extends string = string> = Field | InlineFragment<PossibleTypes> | FragmentSpread<FragmentDefinition<any, PossibleTypes> | FragmentDefinitionWithVariables<any, PossibleTypes>>; | ||
] ? 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 SelectionSetOutput<T extends ReadonlyArray<SelectionSetSelection>, PossibleTypes extends string> = InterfaceCollapse<T extends Function ? never : PossibleTypes extends infer PT ? BuildSelectionSet<T, PT & string> : never>; | ||
export type OutputOf<T> = T extends Operation<infer Output> ? Output : SelectionOutput<T>; | ||
@@ -32,2 +32,3 @@ export type VariablesOf<T> = T extends Operation<any, infer Variables> ? Variables : T extends FragmentDefinitionWithVariables<any, any, any, infer Variables> ? Variables : never; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=helpers.d.ts.map |
{ | ||
"name": "@gqlb/core", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -23,7 +23,11 @@ import { | ||
export type ReadonlyIntersectionCollapse<T> = T extends Function | ||
? never | ||
: { | ||
readonly [K in keyof T]: T[K]; | ||
}; | ||
type InterfaceCollapse<T> = T extends Record<string, any> | ||
? { | ||
readonly [K in keyof T]: T[K] extends ReadonlyArray<Record<string, any>> | ||
? readonly InterfaceCollapse<T[K][number]>[] | ||
: InterfaceCollapse<T[K]>; | ||
} | ||
: T extends ReadonlyArray<infer U> | ||
? ReadonlyArray<InterfaceCollapse<U>> | ||
: T; | ||
@@ -104,7 +108,9 @@ export type SelectionOutput<T> = T extends Field<any, any, infer O> | ||
PossibleTypes extends string, | ||
> = T extends Function | ||
? never | ||
: PossibleTypes extends infer PT | ||
? ReadonlyIntersectionCollapse<BuildSelectionSet<T, PT & string>> | ||
: never; | ||
> = InterfaceCollapse< | ||
T extends Function | ||
? never | ||
: PossibleTypes extends infer PT | ||
? BuildSelectionSet<T, PT & string> | ||
: never | ||
>; | ||
@@ -111,0 +117,0 @@ export type OutputOf<T> = T extends Operation<infer Output> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
82765
1745