UNPKG

1.87 kBTypeScriptView Raw
1/**
2Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
3*/
4export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
5/**
6Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
7*/
8type Constructor<T, Arguments extends unknown[] = any[]> = new (...arguments_: Arguments) => T;
9/**
10Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
11*/
12export type Class<T, Arguments extends unknown[] = any[]> = Constructor<T, Arguments> & {
13 prototype: T;
14};
15/**
16Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
17*/
18export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
19declare global {
20 interface SymbolConstructor {
21 readonly observable: symbol;
22 }
23}
24/**
25Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
26*/
27export type ObservableLike = {
28 subscribe(observer: (value: unknown) => void): void;
29 [Symbol.observable](): ObservableLike;
30};
31export type Falsy = false | 0 | 0n | '' | null | undefined;
32export type WeakRef<T extends object> = {
33 readonly [Symbol.toStringTag]: 'WeakRef';
34 deref(): T | undefined;
35};
36export type ArrayLike<T> = {
37 readonly [index: number]: T;
38 readonly length: number;
39};
40export type NodeStream = {
41 pipe<T extends NodeJS.WritableStream>(destination: T, options?: {
42 end?: boolean;
43 }): T;
44} & NodeJS.EventEmitter;
45export type Predicate = (value: unknown) => boolean;
46export type NonEmptyString = string & {
47 0: string;
48};
49export type Whitespace = ' ';
50export {};