source: trip-planner-front/node_modules/type-fest/source/basic.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/// <reference lib="es2020.bigint"/>
2
3// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out.
4/**
5Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
6*/
7export type Primitive =
8 | null
9 | undefined
10 | string
11 | number
12 | boolean
13 | symbol
14 | bigint;
15
16// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default
17/**
18Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
19*/
20export type Class<T = unknown, Arguments extends any[] = any[]> = new(...arguments_: Arguments) => T;
21
22/**
23Matches a JSON object.
24
25This 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 { … }`.
26*/
27export type JsonObject = {[Key in string]?: JsonValue};
28
29/**
30Matches a JSON array.
31*/
32export interface JsonArray extends Array<JsonValue> {}
33
34/**
35Matches any valid JSON value.
36*/
37export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
38
39declare global {
40 interface SymbolConstructor {
41 readonly observable: symbol;
42 }
43}
44
45/**
46Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
47*/
48export interface ObservableLike {
49 subscribe(observer: (value: unknown) => void): void;
50 [Symbol.observable](): ObservableLike;
51}
Note: See TracBrowser for help on using the repository browser.