aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-polyfills/src/types/helpers.d.ts
blob: 83726dadd19d7247d4b207ae5b94d277c3d6dbc9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
type AnyFunction = (...args: any[]) => any;
type AnyClass = new (...args: any[]) => any;
type AnyCallable = AnyFunction | AnyClass;

type MapKeysType<T extends Map<unknown, unknown>> = T extends Map<infer K, infer V> ? K : never;
type MapValuesType<T extends Map<unknown, unknown>> = T extends Map<infer K, infer V> ? V : never;

type Mutable<T> = { -readonly [K in keyof T]: T[K] };

/** Excluding the BigInt typed arrays */
type TypedArrayConstructor = 
    | typeof Uint8Array | typeof Uint16Array | typeof Uint32Array | typeof Uint8ClampedArray
    | typeof Int8Array | typeof Int16Array | typeof Int32Array | typeof Float32Array | typeof Float64Array;