@medusajs/types
Version:
Medusa Types definition
26 lines • 1.44 kB
TypeScript
import { ExcludedProps, TypeOnly } from "./common";
type Marker = [never, 0, 1, 2, 3, 4];
type RawBigNumberPrefix = "raw_";
type ExpandStarSelector<T extends object, Depth extends number, Exclusion extends string[]> = ObjectToIndexFields<T & {
"*": "*";
}, Depth, Exclusion>;
/**
* Output an array of strings representing the path to each leaf node in an object
*/
export type ObjectToIndexFields<MaybeT, Depth extends number = 2, Exclusion extends string[] = [], T = TypeOnly<MaybeT> & {
"*": "*";
}> = Depth extends never ? never : T extends object ? {
[K in keyof T]: K extends `${RawBigNumberPrefix}${string}` ? Exclude<K, symbol> : K extends ExcludedProps ? never : K extends Exclusion[number] ? never : TypeOnly<T[K]> extends Array<infer R> ? TypeOnly<R> extends Date ? Exclude<K, symbol> : TypeOnly<R> extends {
__typename: any;
} ? `${Exclude<K, symbol>}.${ExpandStarSelector<TypeOnly<R>, Marker[Depth], [
K & string,
...Exclusion
]>}` : TypeOnly<R> extends object ? Exclude<K, symbol> : never : TypeOnly<T[K]> extends Date ? Exclude<K, symbol> : TypeOnly<T[K]> extends {
__typename: any;
} ? `${Exclude<K, symbol>}.${ExpandStarSelector<TypeOnly<T[K]>, Marker[Depth], [
K & string,
...Exclusion
]>}` : T[K] extends object ? Exclude<K, symbol> : Exclude<K, symbol>;
}[keyof T] : never;
export {};
//# sourceMappingURL=query-input-config-fields.d.ts.map