import type { ReduceSafe } from './reduce.js'; import type { ES_TYPE, JsonObject } from '@blake.regalia/belt'; /** * Namespace offering utility types for adjusting the strength of declared datatypes. * * Utilities: * - {@link Datatypes.Weaken} */ export declare namespace Datatypes { export type Strength = 'weakest' | 'mild' | 'strongest'; type MetaDescriptor = { [ES_TYPE]: any; }; type WeakenDatatype = g_datatype extends { [ES_TYPE]: infer w_scalar; } ? { weakest: w_scalar extends string ? string : w_scalar extends number ? number : w_scalar extends boolean ? boolean : w_scalar; mild: w_scalar; strongest: g_datatype; }[s_strength] : never; type WeakenValue = w_value extends MetaDescriptor ? WeakenDatatype : w_value extends [infer w0] ? [WeakenValue] : w_value extends [infer w0, ...infer a_rest] ? [WeakenValue, ...WeakenValue] : w_value extends Array ? WeakenValue[] : w_value extends JsonObject ? WeakenObject : w_value; type WeakenObject = { [si_key in keyof h_obj]: WeakenValue; }; /** * Weaken the given Datatype, created using one of: {@link CosmWasmDatatype} * * For example: * ``` * type Subject = {foo: Uint128}; * * type Strongest = Datatypes.Weaken; // {foo: Uint128} * type Mild = Datatypes.Weaken; // {foo: `${bigint}`} * type Weakest = Datatypes.Weaken; // {foo: string} * ``` */ export type Weaken = ReduceSafe<10, WeakenObject>; export {}; } //# sourceMappingURL=datatypes.d.ts.map