UNPKG

969 BTypeScriptView Raw
1export type Present<T> = Exclude<T, null | undefined>;
2export type Nullable<T> = T | null;
3export type Optional<T> = T | undefined;
4export type Maybe<T> = Nullable<T> | Optional<T>;
5export type FIXME<T, _S extends string> = T;
6
7export type Dict<T = unknown> = Record<string, T>;
8
9export type DictValue<D extends Dict> = D extends Dict<infer V> ? V : never;
10
11export interface Unique<T> {
12 'Unique [id=ada0f31f-27f7-4ab0-bc03-0005387c9d5f]': T;
13}
14
15export type Recast<T, U> = (T & U) | U;
16
17/**
18 * This is needed because the normal IteratorResult in the TypeScript
19 * standard library is generic over the value in each tick and not over
20 * the return value. It represents a standard ECMAScript IteratorResult.
21 */
22export type RichIteratorResult<Tick, Return> =
23 | {
24 done: false;
25 value: Tick;
26 }
27 | {
28 done: true;
29 value: Return;
30 };
31
32export type Destroyable = object;
33export type Destructor<T extends Destroyable> = (destroyable: T) => void;