import { SetComplement, DeepReadonly } from './mapped-types'; /** * $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]; /** * $ReadOnly * @desc Get the read-only version of a given object type `T` (it works on nested data structure) * @see https://flow.org/en/docs/types/utilities/#toc-readonly * @example * type Props = { name: string; age: number; visible: boolean }; * * // Expect: Readonly<{ name: string; age?: number | undefined; visible: boolean; }> * type ReadOnlyProps = $ReadOnly; */ export declare type $ReadOnly = DeepReadonly; /** * $Diff * @desc Get the set difference of a given object types `T` and `U` (`T \ U`) * @see https://flow.org/en/docs/types/utilities/#toc-diff * @example * type Props = { name: string; age: number; visible: boolean }; * type DefaultProps = { age: number }; * * // Expect: { name: string; visible: boolean; } * type RequiredProps = Diff; */ export declare type $Diff = Pick>; /** * $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]; /** * $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; /** * $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; /** * $NonMaybeType * @desc Excludes null and undefined from T * @see https://flow.org/en/docs/types/utilities/#toc-nonmaybe * @example * type MaybeName = string | null; * * // Expect: string * type Name = $NonMaybeType; */ export declare type $NonMaybeType = NonNullable; /** * 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;