import { Numeric } from './general-types'; /** * Nullish * @desc Type representing [nullish values][https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#nullish-coalescing] in TypeScript: `null | undefined` * @example * type Various = 'a' | 'b' | undefined; * * // Expect: "a" | "b" * Exclude; */ export declare type Nullish = null | undefined; /** * Tests for Nullish by simply comparing `val` for equality with `null`. * @example * const consumer = (param: Nullish | string): string => { * if (isNullish(param)) { * // typeof param === Nullish * return String(param) + ' was Nullish'; * } * // typeof param === string * return param.toString(); * }; */ export declare const isNullish: (value: unknown) => value is Nullish; /** * Primitive * @desc Type representing [`Primitive`](https://developer.mozilla.org/en-US/docs/Glossary/Primitive) types in TypeScript: `string | number | bigint | boolean | symbol | null | undefined` * @example * type Various = number | string | object; * * // Expect: object * type Cleaned = Exclude */ export declare type Primitive = Optional; /** * Tests for one of the [`Primitive`](https://developer.mozilla.org/en-US/docs/Glossary/Primitive) types using the JavaScript [`typeof`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof) operator * * Clarification: TypeScript overloads this operator to produce TypeScript types if used in context of types. * * @param value The value to be tested * @returns If `val` is primitive. If used in the flow of the program typescript will infer type-information from this. * * @example * const consumer = (value: Primitive | Primitive[]) => { * if (isPrimitive(value)) { * return console.log('Primitive value: ', value); * } * // type of value now inferred as Primitive[] * value.map((primitive) => consumer(primitive)); * }; */ export declare const isPrimitive: (value: any) => value is Optional; /** * Array * @desc Type representing [`Array`] in TypeScript */ export interface Array { forEachParallel(func: (item: T) => Promise): Promise; forEachSequential(func: (item: T) => Promise): Promise; } /** * NonNull * @desc Excludes null and undefined from T * @see https://flow.org/en/docs/types/utilities/#toc-nonmaybe * @example * type StringOrNull = string | null; * * // Expect: string * type Name = NonNull; */ export declare type NonNull = NonNullable; /** * Undef * @desc Type representing [`Undef`] in TypeScript: `T | undefined` */ export declare type Undef = T | undefined; /** * Keys * @desc Type representing [`Keys`] in TypeScript: `T` */ export declare type Keys = keyof T; /** * Optional * @desc Type representing [`Optional`] in TypeScript: `T | null | undefined` */ export declare type Optional = T | Nullish; /** * OptionalString * @desc Type representing [`Optional`] string type in TypeScript: `string | null | undefined` */ export declare type OptionalString = Optional; /** * OptionalDate * @desc Type representing [`Optional`] date type in TypeScript: `date | null | undefined` */ export declare type OptionalDate = Optional; /** * OptionalPropertyKey * @desc Type representing [`Optional`] property key type in TypeScript: `PropertyKey | null | undefined` */ export declare type OptionalPropertyKey = Optional; /** * OptionalNumber * @desc Type representing [`Optional`] number type in TypeScript: `number | bigint | null | undefined` */ export declare type OptionalNumber = Optional; /** * OptionalBoolean * @desc Type representing [`Optional`] boolean type in TypeScript: `boolean | null | undefined` */ export declare type OptionalBoolean = Optional; /** * DomElement * @desc Type representing [`DomElement`] */ export declare type DomElement = Element | Node | Document | HTMLElement; /** * OptionalDomElement * @desc Type representing optional [`DomElement`] */ export declare type OptionalDomElement = Optional; /** * Truthy * @desc Type representing truthy values in TypeScript: `true | 1 | 'on' | 'y' | 't'` * @example * type Various = 'a' | 'b' | undefined | true; * * // Expect: "a" | "b" * Exclude; */ export declare type Truthy = true | 1 | 'on' | 'y' | 't'; /** * Truthy * @desc Type representing optional truthy values in TypeScript: `true | 1 | 'on' | null | undefined` * @example * type Various = 'a' | 'b' | undefined | true; * * // Expect: "a" | "b" * Exclude; */ export declare type OptionalTruthy = Optional; /** * Tests for Truthy value * * The value is mostly in added type-information and explicitly * but in case of this simple type much the same can often be archived by just using double negation `!!`: * @example * const consumer = (value: boolean | Truthy) => { * if (!!value) { * return ; * } * type newType = typeof value; // === true * // do stuff * }; */ export declare const isTruthy: (value: unknown) => value is Truthy; /** * Falsy * @desc Type representing falsy values in TypeScript: `false | "" | 0 | 'off' | 'n' | 'f'` * @example * type Various = 'a' | 'b' | undefined | false; * * // Expect: "a" | "b" * Exclude; */ export declare type Falsy = false | '' | 0 | 'off' | 'n' | 'f'; /** * Falsy * @desc Type representing optional falsy values in TypeScript: `false | "" | 0 | null | undefined` * @example * type Various = 'a' | 'b' | undefined | false; * * // Expect: "a" | "b" * Exclude; */ export declare type OptionalFalsy = Optional; /** * Tests for Falsy by simply applying negation `!` to the tested `val`. * * The value is mostly in added type-information and explicitly, * but in case of this simple type much the same can often be archived by just using negation `!`: * @example * const consumer = (value: boolean | Falsy) => { * if (!value) { * return ; * } * type newType = typeof value; // === true * // do stuff * }; */ export declare const isFalsy: (value: unknown) => value is Falsy; /** * NullOrNotEmpty * @desc Type representing null or not empty property key */ export declare type NullOrNotEmpty = Optional; /** * ObjectMap * @desc Type representing object key-value mappings */ export declare type ObjectMap = { [key: string]: Optional; }; /** * StringSet * @desc Type representing string {@link Set} */ export declare type StringSet = Set; /** * NumberSet * @desc Type representing number {@link Set} */ export declare type NumberSet = Set; /** * DateSet * @desc Type representing date {@link Set} */ export declare type DateSet = Set; /** * PropertySet * @desc Type representing property {@link Set} */ export declare type PropertySet = Set; /** * OptionalSet * @desc Type representing optional {@link Set} */ export declare type OptionalSet = Set>; /** * StringRecord * @desc Type representing string {@link Record} */ export declare type StringRecord = Record; /** * PropertyRecord * @desc Type representing property {@link Record} */ export declare type PropertyRecord = Record; //# sourceMappingURL=standard-types.d.ts.map