summaryrefslogtreecommitdiff
path: root/client/node_modules/type-fest/source/basic.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/node_modules/type-fest/source/basic.d.ts')
-rw-r--r--client/node_modules/type-fest/source/basic.d.ts67
1 files changed, 67 insertions, 0 deletions
diff --git a/client/node_modules/type-fest/source/basic.d.ts b/client/node_modules/type-fest/source/basic.d.ts
new file mode 100644
index 0000000..d380c8b
--- /dev/null
+++ b/client/node_modules/type-fest/source/basic.d.ts
@@ -0,0 +1,67 @@
+/// <reference lib="esnext"/>
+
+// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out.
+/**
+Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
+*/
+export type Primitive =
+ | null
+ | undefined
+ | string
+ | number
+ | boolean
+ | symbol
+ | bigint;
+
+// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default
+/**
+Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
+*/
+export type Class<T = unknown, Arguments extends any[] = any[]> = new(...arguments_: Arguments) => T;
+
+/**
+Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
+*/
+export type TypedArray =
+ | Int8Array
+ | Uint8Array
+ | Uint8ClampedArray
+ | Int16Array
+ | Uint16Array
+ | Int32Array
+ | Uint32Array
+ | Float32Array
+ | Float64Array
+ | BigInt64Array
+ | BigUint64Array;
+
+/**
+Matches a JSON object.
+
+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 { … }`.
+*/
+export type JsonObject = {[Key in string]?: JsonValue};
+
+/**
+Matches a JSON array.
+*/
+export interface JsonArray extends Array<JsonValue> {}
+
+/**
+Matches any valid JSON value.
+*/
+export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
+
+declare global {
+ interface SymbolConstructor {
+ readonly observable: symbol;
+ }
+}
+
+/**
+Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
+*/
+export interface ObservableLike {
+ subscribe(observer: (value: unknown) => void): void;
+ [Symbol.observable](): ObservableLike;
+}