/** * Replaces ts-toolbelt's Any.Compute generic by not 'computing' primitives */ import type { N } from 'ts-toolbelt'; import type { If } from 'ts-toolbelt/out/Any/If'; import type { Key } from 'ts-toolbelt/out/Any/Key'; import type { BuiltIn } from 'ts-toolbelt/out/Misc/BuiltIn'; import type { Has } from 'ts-toolbelt/out/Union/Has'; import type { CosmWasmDatatype } from './cosmwasm.js'; /** * */ type Bypass = boolean | number | string | BuiltIn | CosmWasmDatatype; /** * @hidden */ export type ComputeRaw = z_thing extends Function ? z_thing : { [w_key in keyof z_thing]: z_thing[w_key]; } & unknown; /** * @hidden */ type ReduceFlat = z_thing extends Bypass ? z_thing : z_thing extends Array ? z_thing extends Array> ? Array<{ [w_key in keyof z_thing[number]]: z_thing[number][w_key]; } & unknown> : z_thing : z_thing extends ReadonlyArray ? z_thing extends ReadonlyArray> ? ReadonlyArray<{ [w_key in keyof z_thing[number]]: z_thing[number][w_key]; } & unknown> : z_thing : ComputeRaw; /** * @hidden */ type ReduceDeep = If, ReduceFlat, N.Sub extends infer c_subdepth ? c_subdepth extends number ? z_thing extends Bypass ? z_thing : If, z_thing, (z_thing extends Array ? z_thing extends Array> ? z_thing extends [infer w_0] ? [ReduceDeep & unknown] : z_thing extends [infer w_0, ...infer a_rest] ? [ReduceDeep & unknown, ...ReduceDeep & unknown] : z_thing extends Array ? (ReduceDeep & unknown)[] : z_thing : z_thing : z_thing extends ReadonlyArray ? z_thing extends ReadonlyArray> ? ReadonlyArray<{ [K in keyof z_thing[number]]: ReduceDeep; } & unknown> : z_thing : { [w_key in keyof z_thing]: ReduceDeep; } & unknown)> : never : never>; /** * Force TS to load a type that has not been computed (to resolve composed * types that TS haven't fully resolved, for display purposes mostly). * @param A to compute * @returns `A` * @example * ```ts * import {A} from 'ts-toolbelt' * * type test0 = A.Compute<{x: 'x'} & {y: 'y'}> // {x: 'x', y: 'y'} * ``` */ export type ReduceSafe = ReduceDeep; export {}; //# sourceMappingURL=reduce.d.ts.map