1 /// <reference lib="esnext"/>
3 // TODO: This can just be `export type Primitive = not object` when the `not` keyword is out.
5 Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
7 export type Primitive =
16 // TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default
18 Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
20 export type Class<T = unknown, Arguments extends any[] = any[]> = new(...arguments_: Arguments) => T;
23 Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
25 export type TypedArray =
39 Matches a JSON object.
41 This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
43 export type JsonObject = {[key: string]: JsonValue};
48 export interface JsonArray extends Array<JsonValue> {}
51 Matches any valid JSON value.
53 export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
56 interface SymbolConstructor {
57 readonly observable: symbol;
62 Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
64 export interface ObservableLike {
65 subscribe(observer: (value: unknown) => void): void;
66 [Symbol.observable](): ObservableLike;