import { NonNull, Optional } from './standard-types'; import { Profile } from './enum-types'; /** * BufferEncoding * @desc Type representing supported buffer encoding settings */ export declare type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'latin1' | 'binary' | 'hex'; /** * ProcessConfig * @desc Type representing supported process configurations */ export declare type ProcessConfig = { readonly env: T; }; export declare const dev: ProcessConfig; export declare const prod: ProcessConfig; export declare const test: ProcessConfig; /** * SearchOptions * @desc Type representing search options */ export declare type SearchOptions = { limit?: number; suggest?: boolean; where?: { [key: string]: string; }; field?: string | string[]; bool?: 'and' | 'or' | 'not'; }; /** * Keys * @desc Get the union type of all the keys in an object type `T` * @see https://flow.org/en/docs/types/utilities/#toc-keys * @example * type Props = { name: string; age: number; visible: boolean }; * * // Expect: "name" | "age" | "visible" * type PropsKeys = Keys; */ export declare type Keys = keyof T; /** * Values * @desc Get the union type of all the values in an object type `T` * @see https://flow.org/en/docs/types/utilities/#toc-values * @example * type Props = { name: string; age: number; visible: boolean }; * * // Expect: string | number | boolean * type PropsValues = Values; */ export declare type Values = T[keyof T]; /** * PropertyType * @desc Get the type of property of an object at a given key `K` * @see https://flow.org/en/docs/types/utilities/#toc-propertytype * @example * // Expect: string; * type Props = { name: string; age: number; visible: boolean }; * type NameType = PropertyType; * * // Expect: boolean * type Tuple = [boolean, number]; * type A = PropertyType; * // Expect: number * type B = PropertyType; */ export declare type PropertyType = T[K]; /** * ElementType * @desc Get the type of elements inside of array, tuple or object of type `T`, that matches the given index type `K` * @see https://flow.org/en/docs/types/utilities/#toc-elementtype * @example * // Expect: string; * type Props = { name: string; age: number; visible: boolean }; * type NameType = ElementType; * * // Expect: boolean * type Tuple = [boolean, number]; * type A = ElementType; * // Expect: number * type B = ElementType; * * // Expect: boolean * type Arr = boolean[]; * type ItemsType = ElementType; * * // Expect: number * type Obj = { [key: string]: number }; * type ValuesType = ElementType; */ export declare type ElementType = T[K]; /** * Shape * @desc Copies the shape of the type supplied, but marks every field optional. * @see https://flow.org/en/docs/types/utilities/#toc-shape * @example * type Props = { name: string; age: number; visible: boolean }; * * // Expect: Partial * type PartialProps = Shape; */ export declare type Shape = Partial; /** * Call * @desc Get the return type from a given typeof expression * @see https://flow.org/en/docs/types/utilities/#toc-call * @example * // Common use-case * const add = (amount: number) => ({ type: 'ADD' as 'ADD', payload: amount }); * type AddAction = Call; // { type: 'ADD'; payload: number } * * // Examples migrated from Flow docs * type ExtractPropType = (arg: T) => T['prop']; * type Obj = { prop: number }; * type PropType = Call>; // number * * type ExtractReturnType any> = (arg: T) => ReturnType; * type Fn = () => number; * type FnReturnType = Call>; // number */ export declare type Call any> = Fn extends (arg: any) => infer RT ? RT : never; /** * Class * @desc Represents constructor of type T * @see https://flow.org/en/docs/types/utilities/#toc-class * @example * class Store {} * function makeStore(storeClass: Class): Store { * return new storeClass(); * } */ export declare type Class = new (...args: any[]) => T; /** * mixed * @desc An arbitrary type that could be anything * @see https://flow.org/en/docs/types/mixed * @example * * function stringify(value: mixed) { * // ... * } * * stringify("foo"); * stringify(3.14); * stringify(null); * stringify({}); */ export declare type mixed = unknown; /** * Numeric * @desc Pair2 type with numeric ("number" | "bigint") value */ export declare type Numeric = number | bigint; /** * Pair2 * @desc Pair2 type with first and second values */ export declare type Tuple2 = { first: T; second: V; }; /** * Pair3 * @desc Pair3 type with first, second and third values */ export declare type Tuple3 = { first: T; second: V; third: R; }; /** * Pair4 * @desc Pair4 type with first, second, third and fourth values */ export declare type Tuple4 = { first: T; second: V; third: R; fourth: S; }; /** * Pair5 * @desc Pair5 type with first, second, third, fourth and fifth values */ export declare type Tuple5 = { first: T; second: V; third: R; fourth: S; fifth: M; }; /** * Pair6 * @desc Pair6 type with first, second, third, fourth, fifth and sixth values */ export declare type Tuple6 = { first: T; second: V; third: R; fourth: S; fifth: M; sixth: N; }; /** * Pair * @desc Pair type with left and right values */ export declare type Pair = { left: T; right: V; }; /** * ReversePair * @desc Revers pair type with left and right values */ export declare type ReversePair = Pair; /** * OptionalPair * @desc Optional pair type with left and right optional values */ export declare type OptionalPair = Pair, Optional>; /** * PartialPair * @desc Partial pair type with left and right partial values */ export declare type PartialPair = Pair, Partial>; /** * RequiredPair * @desc Required pair type with left and right required values */ export declare type RequiredPair = Pair, Required>; /** * NonNullPair * @desc Non-nullable pair type with left and right non-nullable values */ export declare type NonNullPair = Pair, NonNull>; /** * OptionalLeft * @desc Optional pair type with optional left value */ export declare type OptionalLeft = Pair, V>; /** * OptionalRight * @desc Optional pair type with optional right value */ export declare type OptionalRight = Pair>; /** * PropertyKeyPair * @desc Property key pair type with left and right property key values */ export declare type PropertyKeyPair = Pair; /** * NumberPair * @desc Number pair type with left and right number values */ export declare type NumberPair = Pair; /** * StringPair * @desc String pair type with left and right string values */ export declare type StringPair = Pair; /** * BooleanPair * @desc Boolean pair type with left and right boolean values */ export declare type BooleanPair = Pair; /** * StringRegexPair * @desc String regex pair type with string left and regex right values */ export declare type StringRegexPair = Pair; /** * RegexStringPair * @desc Regex string pair type with regex left and string right values */ export declare type RegexStringPair = Pair; /** * KeyValue * @desc KeyValue type with key and value properties */ export declare type KeyValue = { key: T; value: V; }; /** * OptionalKeyValue * @desc KeyValue type with key and optional value properties */ export declare type OptionalKeyValue = KeyValue>; /** * PartialKeyValue * @desc KeyValue type with key and partial value properties */ export declare type PartialKeyValue = KeyValue>; /** * RequiredKeyValue * @desc KeyValue type with key and required value properties */ export declare type RequiredKeyValue = KeyValue>; /** * NonNullKeyValue * @desc KeyValue type with key and non-nullable value properties */ export declare type NonNullKeyValue = KeyValue>; /** * NameValue * @desc NameValue type with {@link PropertyKey} name and {@link V} value properties */ export declare type NameValue = { name: T; value: V; }; /** * OptionalNameValue * @desc Optional name-value type with {@link PropertyKey} name and {@link Optional} value properties */ export declare type OptionalNameValue = NameValue>; /** * PartialValue * @desc NameValue type with {@link PropertyKey} name and {@link Partial} value properties */ export declare type PartialValue = NameValue>; /** * RequiredValue * @desc NameValue type with {@link PropertyKey} name and {@link Required} value properties */ export declare type RequiredValue = NameValue>; /** * NonNullNameValue * @desc Non-nullable name-value type with {@link PropertyKey} name and {@link NonNull} value properties */ export declare type NonNullNameValue = NameValue>; /** * NumberNameValue * @desc Number name-value type with {@link PropertyKey} name and {@link number} value properties */ export declare type NumberNameValue = NameValue; /** * StringNameValue * @desc String name-value type with {@link PropertyKey} name and {@link string} value properties */ export declare type StringNameValue = NameValue; /** * BooleanNameValue * @desc Boolean name-value type with {@link PropertyKey} name and {@link boolean} value properties */ export declare type BooleanNameValue = NameValue; /** * RegexNameValue * @desc Regex name-value type with {@link PropertyKey} name and {@link RegExp} value properties */ export declare type RegexNameValue = NameValue; /** * RangeValue * @desc RangeValue type with {@link T} lower and {@link T} upper bound properties */ export declare type Range = { lower: T; upper: T; }; /** * OptionalRange * @desc OptionalRange type with optional lower and upper bound properties */ export declare type OptionalRange = Range>; /** * PartialRange * @desc OptionalRange type with partial lower and upper bound properties */ export declare type PartialRange = Range>; /** * RequiredRange * @desc OptionalRange type with required lower and upper bound properties */ export declare type RequiredRange = Range>; /** * NonNullRange * @desc OptionalRange type with non-nullable lower and upper bound properties */ export declare type NonNullRange = Range>; /** * NumberRange * @desc NumberRange type with number lower and upper bound properties */ export declare type NumberRange = Range; /** * DateRange * @desc DateRange type with date lower and upper bound properties */ export declare type DateRange = Range; /** * KeywordData * @desc KeywordData type with double-sized string/number array values */ export declare type KeywordData = [T, Numeric]; /** * KeywordDict * @desc KeywordDict record type with string keys and keyword data values */ export declare type KeywordDict = Record>; //# sourceMappingURL=general-types.d.ts.map