import * as t from "io-ts"; /** * Returns a subset of the input objects fields. * * @param obj the input object * @param props an array of keys to preserve */ export declare const pick: (props: readonly K[], obj: T) => Pick; /** * An io-ts Type tagged with T */ export type Tagged = t.Type; /** * Tags an io-ts type with an interface T */ export declare const tag: () => (type: t.Type) => Tagged; /** * Removes any extra tags from a type that extends a basic type. * * Basic types: string, number, boolean */ export type UntagBasicType = A extends string ? string : A extends number ? number : A extends boolean ? boolean : never; /** * Returns the passed tagged basic value after converting it to its basic type. */ export declare const untag: (a: T) => UntagBasicType; /** * Creates an io-ts Type from an enum */ export declare const enumType: (e: object, name: string) => t.Type; /** * Creates an io-ts Type from a ReadonlySet */ export declare const readonlySetType: (o: t.Type, name: string) => t.Type, unknown, unknown>; export interface ReadOnlyNonEmptySet extends ReadonlySet { } /** * Creates an io-ts Type from a ReadonlyNonEmptySet */ export declare const readonlyNonEmptySetType: (o: t.Type, name: string) => t.Type, unknown, unknown>; /** * Returns a new type that has only the F fields of type T. */ export type LimitedFields = { [P in F]: T[P]; }; /** * True when the input is an object (and not array). */ export declare const isObject: (o: {}) => boolean; /** * Return an object filtering out keys that point to undefined values. */ export declare const withoutUndefinedValues: (obj: T) => T; /** * Return a new type that validates successfully only * when the instance (object) contains no unknown properties. * * See https://github.com/gcanti/io-ts/issues/106 * * @\required required properties * @optional optional object properties */ export declare const strictInterfaceWithOptionals: (required: R, optional: O, name: string) => t.Type & t.TypeOfPartialProps, t.OutputOfProps & t.OutputOfPartialProps, unknown>; /** * Sets properties default values when calling t.validate() method on models * see https://github.com/gcanti/io-ts/issues/8 */ export declare const withDefault: (type: T, defaultValue: t.TypeOf) => t.Type, any, unknown>; /** * From T omit a set of properties K */ export type Omit = Pick>; export type ReplaceProp1 = { [K in P1]: A; } & Pick>; export type ReplaceProp2 = { [K in P1]: ReplaceProp1; } & Pick>; /** * Removes null/undefined types from T[P1] */ export type RequiredProp1 = ReplaceProp1>; /** * Removes null/undefined types from T[P1][P2] */ export type RequiredProp2 = ReplaceProp2>; export declare const requiredProp1: (type: t.Type, p: P, name?: string) => t.Type, O, I>; export declare const replaceProp1: (type: t.Type, p: P, typeB: t.Type, name?: string) => t.Type, O, I>; /** * Returns the type `A` if `T` is a `Promise`, or else returns `never` */ export type PromiseType = T extends Promise ? A : never; /** * Extract the type of the first element of an array */ export type Head> = T[0]; /** * Extract the type of the sub-array of the tail of an array */ export type Tail> = T extends readonly [ unknown, ...infer Rest ] ? Rest : readonly []; /** * Whether an array is empty or has only one element */ export type HasTail> = T extends readonly [] | readonly [unknown] ? false : true;