@esposter/shared 4.2.0 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2493 @@
1
+ import { z } from "zod";
2
+ import { Result, ResultAsync } from "neverthrow";
3
+ import { HTMLElement } from "node-html-parser";
4
+ import { DefaultTreeAdapterTypes, html as html$1 } from "parse5";
5
+ //#region src/models/error/ForbiddenError.d.ts
6
+ export declare class ForbiddenError extends Error {
7
+ constructor(message: string);
8
+ }
9
+ //#endregion
10
+ //#region src/models/shared/Operation.d.ts
11
+ export declare enum Operation {
12
+ Create = "Create",
13
+ Delete = "Delete",
14
+ Push = "Push",
15
+ Read = "Read",
16
+ Unshift = "Unshift",
17
+ Update = "Update"
18
+ }
19
+ //#endregion
20
+ //#region src/models/error/InvalidOperationError.d.ts
21
+ export declare class InvalidOperationError extends Error {
22
+ constructor(operation: Operation, name: string, message: string);
23
+ }
24
+ //#endregion
25
+ //#region src/models/error/NotFoundError.d.ts
26
+ export declare class NotFoundError<T extends string = string> extends Error {
27
+ constructor(name: T, id: string);
28
+ }
29
+ //#endregion
30
+ //#region src/models/error/NotInitializedError.d.ts
31
+ export declare class NotInitializedError<T extends string = string> extends Error {
32
+ constructor(name: T);
33
+ }
34
+ //#endregion
35
+ //#region src/models/error/WordFilteredError.d.ts
36
+ export declare class WordFilteredError extends Error {
37
+ constructor(message: string);
38
+ }
39
+ //#endregion
40
+ //#region src/models/eventEmitter/EventListenerEntry.d.ts
41
+ export interface EventListenerEntry<TEventMap> {
42
+ isOnce: boolean;
43
+ listener: TEventMap[keyof TEventMap];
44
+ }
45
+ //#endregion
46
+ //#region src/models/eventEmitter/EventListenerMap.d.ts
47
+ export type EventListenerMap<TEventMap> = { [TEvent in keyof TEventMap]: (...args: never[]) => void; };
48
+ //#endregion
49
+ //#region src/models/eventEmitter/TypedEventEmitter.d.ts
50
+ export declare class TypedEventEmitter<TEventMap extends EventListenerMap<TEventMap>> {
51
+ #private;
52
+ emit<TEvent extends keyof TEventMap>(event: TEvent, ...args: Parameters<TEventMap[TEvent]>): boolean;
53
+ off<TEvent extends keyof TEventMap>(event: TEvent, listener: TEventMap[TEvent]): void;
54
+ on<TEvent extends keyof TEventMap>(event: TEvent, listener: TEventMap[TEvent]): void;
55
+ once<TEvent extends keyof TEventMap>(event: TEvent, listener: TEventMap[TEvent]): void;
56
+ removeAllListeners(event?: keyof TEventMap): void;
57
+ }
58
+ //#endregion
59
+ //#region src/models/history/History.d.ts
60
+ export interface History<T> {
61
+ future: T[];
62
+ limit: number;
63
+ past: T[];
64
+ }
65
+ //#endregion
66
+ //#region src/models/history/HistoryStep.d.ts
67
+ export interface HistoryStep<T> {
68
+ entry?: T;
69
+ history: History<T>;
70
+ }
71
+ //#endregion
72
+ //#region src/models/indexedDb/DatabaseStoreSchema.d.ts
73
+ export interface DatabaseStoreSchema {
74
+ indexes: Record<string, IDBValidKey>;
75
+ key: IDBValidKey;
76
+ value: unknown;
77
+ }
78
+ //#endregion
79
+ //#region src/models/indexedDb/DatabaseSchema.d.ts
80
+ export type DatabaseSchema = Record<string, DatabaseStoreSchema>;
81
+ //#endregion
82
+ //#region src/models/indexedDb/DatabaseStoreName.d.ts
83
+ export type DatabaseStoreName<TSchema extends DatabaseSchema> = [LiteralKeys<TSchema>] extends [never] ? string : LiteralKeys<TSchema>;
84
+ type LiteralKeys<TSchema> = keyof { [TKey in keyof TSchema as string extends TKey ? never : TKey]: TKey; } & string;
85
+ //#endregion
86
+ //#region src/models/indexedDb/DatabaseIndexName.d.ts
87
+ export type DatabaseIndexName<TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>> = string extends keyof TSchema[TStoreName]["indexes"] ? string : keyof TSchema[TStoreName]["indexes"] & string;
88
+ //#endregion
89
+ //#region src/models/indexedDb/DatabaseIndexCreator.d.ts
90
+ export interface DatabaseIndexCreator<TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>> {
91
+ createIndex: (name: DatabaseIndexName<TSchema, TStoreName>, keyPath: string | string[], options?: IDBIndexParameters) => void;
92
+ }
93
+ //#endregion
94
+ //#region src/models/indexedDb/DatabaseIndexKey.d.ts
95
+ export type DatabaseIndexKey<TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>, TIndexName extends DatabaseIndexName<TSchema, TStoreName>> = TSchema[TStoreName]["indexes"][TIndexName];
96
+ //#endregion
97
+ //#region src/models/indexedDb/DatabaseIndex.d.ts
98
+ export interface DatabaseIndex<TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>, TIndexName extends DatabaseIndexName<TSchema, TStoreName>> {
99
+ getAll: (query?: DatabaseIndexKey<TSchema, TStoreName, TIndexName> | IDBKeyRange | null, count?: number) => Promise<TSchema[TStoreName]["value"][]>;
100
+ getAllKeys: (query?: DatabaseIndexKey<TSchema, TStoreName, TIndexName> | IDBKeyRange | null, count?: number) => Promise<TSchema[TStoreName]["key"][]>;
101
+ }
102
+ //#endregion
103
+ //#region src/models/indexedDb/DatabaseObjectStoreReader.d.ts
104
+ export interface DatabaseObjectStoreReader<TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>> {
105
+ get: (key: TSchema[TStoreName]["key"]) => Promise<TSchema[TStoreName]["value"] | undefined>;
106
+ getAll: (query?: IDBKeyRange | null | TSchema[TStoreName]["key"], count?: number) => Promise<TSchema[TStoreName]["value"][]>;
107
+ getAllKeys: (query?: IDBKeyRange | null | TSchema[TStoreName]["key"], count?: number) => Promise<TSchema[TStoreName]["key"][]>;
108
+ index: <TIndexName extends DatabaseIndexName<TSchema, TStoreName>>(name: TIndexName) => DatabaseIndex<TSchema, TStoreName, TIndexName>;
109
+ }
110
+ //#endregion
111
+ //#region src/models/indexedDb/DatabaseObjectStoreWriter.d.ts
112
+ export interface DatabaseObjectStoreWriter<TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>> {
113
+ delete: (query: IDBKeyRange | TSchema[TStoreName]["key"]) => Promise<void>;
114
+ put: (value: TSchema[TStoreName]["value"], key?: TSchema[TStoreName]["key"]) => Promise<TSchema[TStoreName]["key"]>;
115
+ }
116
+ //#endregion
117
+ //#region src/models/indexedDb/DatabaseObjectStore.d.ts
118
+ export type DatabaseObjectStore<TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>, TMode extends IDBTransactionMode> = DatabaseObjectStoreReader<TSchema, TStoreName> & (TMode extends "readonly" ? unknown : DatabaseObjectStoreWriter<TSchema, TStoreName> & (TMode extends "versionchange" ? DatabaseIndexCreator<TSchema, TStoreName> : unknown));
119
+ //#endregion
120
+ //#region src/models/indexedDb/DatabaseTransaction.d.ts
121
+ export interface DatabaseTransaction<TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>, TMode extends IDBTransactionMode> {
122
+ done: Promise<void>;
123
+ objectStore: <TName extends TStoreName>(name: TName) => DatabaseObjectStore<TSchema, TName, TMode>;
124
+ }
125
+ //#endregion
126
+ //#region src/models/indexedDb/Database.d.ts
127
+ export interface Database<TSchema extends DatabaseSchema = DatabaseSchema> {
128
+ close: () => void;
129
+ delete: <TStoreName extends DatabaseStoreName<TSchema>>(storeName: TStoreName, query: IDBKeyRange | TSchema[TStoreName]["key"]) => Promise<void>;
130
+ get: <TStoreName extends DatabaseStoreName<TSchema>>(storeName: TStoreName, key: TSchema[TStoreName]["key"]) => Promise<TSchema[TStoreName]["value"] | undefined>;
131
+ getAll: <TStoreName extends DatabaseStoreName<TSchema>>(storeName: TStoreName, query?: IDBKeyRange | null | TSchema[TStoreName]["key"], count?: number) => Promise<TSchema[TStoreName]["value"][]>;
132
+ getAllKeys: <TStoreName extends DatabaseStoreName<TSchema>>(storeName: TStoreName, query?: IDBKeyRange | null | TSchema[TStoreName]["key"], count?: number) => Promise<TSchema[TStoreName]["key"][]>;
133
+ readonly name: string;
134
+ put: <TStoreName extends DatabaseStoreName<TSchema>>(storeName: TStoreName, value: TSchema[TStoreName]["value"], key?: TSchema[TStoreName]["key"]) => Promise<TSchema[TStoreName]["key"]>;
135
+ transaction: <TStoreName extends DatabaseStoreName<TSchema>, TMode extends IDBTransactionMode = "readonly">(storeNames: readonly TStoreName[] | TStoreName, mode?: TMode, options?: IDBTransactionOptions) => DatabaseTransaction<TSchema, TStoreName, TMode>;
136
+ }
137
+ //#endregion
138
+ //#region src/models/indexedDb/UpgradeDatabase.d.ts
139
+ export interface UpgradeDatabase<TSchema extends DatabaseSchema = DatabaseSchema> extends Database<TSchema> {
140
+ createObjectStore: <TStoreName extends DatabaseStoreName<TSchema>>(name: TStoreName, options?: IDBObjectStoreParameters) => DatabaseObjectStore<TSchema, TStoreName, "versionchange">;
141
+ }
142
+ //#endregion
143
+ //#region src/models/indexedDb/DatabaseOpenOptions.d.ts
144
+ export interface DatabaseOpenOptions<TSchema extends DatabaseSchema = DatabaseSchema> {
145
+ blocked?: (currentVersion: number, blockedVersion: null | number) => void;
146
+ blocking?: (currentVersion: number, blockedVersion: null | number) => void;
147
+ terminated?: () => void;
148
+ upgrade?: (database: UpgradeDatabase<TSchema>, oldVersion: number, newVersion: null | number, transaction: DatabaseTransaction<TSchema, DatabaseStoreName<TSchema>, "versionchange">) => void;
149
+ }
150
+ //#endregion
151
+ //#region src/models/jsonPatch/JsonPatchOperationType.d.ts
152
+ export declare enum JsonPatchOperationType {
153
+ Add = "add",
154
+ Copy = "copy",
155
+ Move = "move",
156
+ Remove = "remove",
157
+ Replace = "replace",
158
+ Test = "test"
159
+ }
160
+ //#endregion
161
+ //#region src/models/jsonPatch/JsonPatchOperation.d.ts
162
+ export type JsonPatchOperation = JsonPatchFromOperation | JsonPatchRemoveOperation | JsonPatchValueOperation;
163
+ interface JsonPatchFromOperation {
164
+ from: string;
165
+ op: JsonPatchOperationType.Copy | JsonPatchOperationType.Move;
166
+ path: string;
167
+ }
168
+ interface JsonPatchRemoveOperation {
169
+ op: JsonPatchOperationType.Remove;
170
+ path: string;
171
+ }
172
+ interface JsonPatchValueOperation {
173
+ op: JsonPatchOperationType.Add | JsonPatchOperationType.Replace | JsonPatchOperationType.Test;
174
+ path: string;
175
+ value: unknown;
176
+ }
177
+ //#endregion
178
+ //#region src/models/jsonPatch/ApplyPatchesResult.d.ts
179
+ export interface ApplyPatchesResult<T> {
180
+ document: T;
181
+ inverses: JsonPatchOperation[];
182
+ }
183
+ //#endregion
184
+ //#region src/models/message/MentionType.d.ts
185
+ export declare enum MentionType {
186
+ Role = "role",
187
+ User = "user"
188
+ }
189
+ //#endregion
190
+ //#region src/models/mime/MimeDatabaseEntry.d.ts
191
+ export interface MimeDatabaseEntry {
192
+ charset?: string;
193
+ compressible?: boolean;
194
+ extensions?: string[];
195
+ source?: string;
196
+ }
197
+ //#endregion
198
+ //#region src/models/object/ObjectMethod.d.ts
199
+ export declare enum ObjectMethod {
200
+ ToString = "toString",
201
+ ValueOf = "valueOf"
202
+ }
203
+ //#endregion
204
+ //#region src/models/profanity/ProfanityOptions.d.ts
205
+ export interface ProfanityOptions {
206
+ isWholeWord: boolean;
207
+ }
208
+ //#endregion
209
+ //#region src/models/reactivity/MaybeReactive.d.ts
210
+ export interface MaybeReactive {
211
+ __v_raw?: unknown;
212
+ }
213
+ //#endregion
214
+ //#region src/models/router/RoutePath.d.ts
215
+ export declare const RoutePath: {
216
+ readonly About: "/about";
217
+ readonly Achievements: "/achievements";
218
+ readonly Anime: "/anime";
219
+ readonly Calls: (id: string) => string;
220
+ readonly CallsIndex: "/calls";
221
+ readonly Clicker: "/clicker";
222
+ readonly Dungeons: "/dungeons";
223
+ readonly FluidSimulator: "/fluid-simulator";
224
+ readonly Genshin: "/genshin";
225
+ readonly Github: "https://github.com/Esposter/Esposter";
226
+ readonly Index: "/";
227
+ readonly Login: "/login";
228
+ readonly Messages: (id: string) => string;
229
+ readonly MessagesDraftsAndSent: "/messages/draftsandsent";
230
+ readonly MessagesFriends: "/messages/friends";
231
+ readonly MessagesIndex: "/messages";
232
+ readonly MessagesInvite: (code: string) => string;
233
+ readonly MessagesMessage: (id: string, rowKey: string) => string;
234
+ readonly MessagesThread: (id: string, rowKey: string) => string;
235
+ readonly Post: (id: string) => string;
236
+ readonly PostCreate: "/post/create";
237
+ readonly PostUpdate: (id: string) => string;
238
+ readonly PrivacyPolicy: "/privacy-policy";
239
+ readonly Resource: (id: string) => string;
240
+ readonly ResourceExplorer: "/resource-explorer";
241
+ readonly ResourceExplorerAll: "/resource-explorer/all";
242
+ readonly ResourceExplorerCreate: "/resource-explorer/create";
243
+ readonly ResourceExplorerCreateType: (type: string) => string;
244
+ readonly ResourceExplorerFavorites: "/resource-explorer/favorites";
245
+ readonly ResourceExplorerRecents: "/resource-explorer/recents";
246
+ readonly ResourceExplorerRecycleBin: "/resource-explorer/recycle-bin";
247
+ readonly ResourceExplorerTags: "/resource-explorer/tags";
248
+ readonly ResourceItems: (id: string) => string;
249
+ readonly User: (id: string) => string;
250
+ readonly UserSettings: "/user/settings";
251
+ readonly View: (type: string, id: string) => string;
252
+ };
253
+ export type RoutePath = typeof RoutePath;
254
+ //#endregion
255
+ //#region src/models/sanitizeHtml/AttributesTransformer.d.ts
256
+ export type AttributesTransformer = (attributes: Record<string, string>) => Record<string, string>;
257
+ //#endregion
258
+ //#region src/models/sanitizeHtml/SanitizeHtmlOptions.d.ts
259
+ export interface SanitizeHtmlOptions {
260
+ allowedAttributes?: Record<string, string[]>;
261
+ allowedClasses?: Record<string, string[]>;
262
+ allowedStyles?: Record<string, Record<string, RegExp[]>>;
263
+ allowedTags?: string[];
264
+ transformAttributes?: Record<string, AttributesTransformer>;
265
+ }
266
+ //#endregion
267
+ //#region src/models/sanitizeHtml/SanitizePolicy.d.ts
268
+ export interface SanitizePolicy {
269
+ allowedAttributes: Record<string, string[]>;
270
+ allowedClasses: Record<string, string[]>;
271
+ allowedSchemes: string[];
272
+ allowedStyles: Record<string, Record<string, RegExp[]>>;
273
+ allowedTags: string[];
274
+ transformAttributes: Record<string, AttributesTransformer>;
275
+ }
276
+ //#endregion
277
+ //#region src/models/shared/ItemEntityType.d.ts
278
+ export interface ItemEntityType<T extends string> {
279
+ type: T;
280
+ }
281
+ export declare const createItemEntityTypeSchema: <T extends z.ZodType<string>>(schema: T) => z.ZodObject<{
282
+ type: T;
283
+ }>;
284
+ //#endregion
285
+ //#region src/models/shared/ItemMetadata.d.ts
286
+ export declare class ItemMetadata {
287
+ createdAt: Date;
288
+ deletedAt: Date | null;
289
+ updatedAt: Date;
290
+ }
291
+ //#endregion
292
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/primitive.d.ts
293
+ /**
294
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
295
+
296
+ @category Type
297
+ */
298
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
299
+ //#endregion
300
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/basic.d.ts
301
+ /**
302
+ Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
303
+
304
+ @category Class
305
+ */
306
+ type Class<T, Arguments extends unknown[] = any[]> = {
307
+ prototype: Pick<T, keyof T>;
308
+ new (...arguments_: Arguments): T;
309
+ };
310
+ //#endregion
311
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/union-to-intersection.d.ts
312
+ /**
313
+ Convert a union type to an intersection type.
314
+
315
+ Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
316
+
317
+ @example
318
+ ```
319
+ import type {UnionToIntersection} from 'type-fest';
320
+
321
+ type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
322
+
323
+ type Intersection = UnionToIntersection<Union>;
324
+ //=> {the(): void} & {great(arg: string): void} & {escape: boolean}
325
+ ```
326
+
327
+ @category Type
328
+ */
329
+ type UnionToIntersection<Union> = (
330
+ // `extends unknown` is always going to be the case and is used to convert the
331
+ // `Union` into a [distributive conditional
332
+ // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
333
+ Union extends unknown ?
334
+ // The union type is used as the only argument to a function since the union
335
+ // of function arguments is an intersection.
336
+ (distributedUnion: Union) => void :
337
+ // This won't happen.
338
+ never
339
+ // Infer the `Intersection` type since TypeScript represents the positional
340
+ // arguments of unions of functions as an intersection of the union.
341
+ ) extends ((mergedIntersection: infer Intersection) => void) ?
342
+ // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
343
+ Intersection & Union : never;
344
+ //#endregion
345
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/keys-of-union.d.ts
346
+ /**
347
+ Create a union of all keys from a given type, even those exclusive to specific union members.
348
+
349
+ Unlike the native `keyof` keyword, which returns keys present in **all** union members, this type returns keys from **any** member.
350
+
351
+ @link https://stackoverflow.com/a/49402091
352
+
353
+ @example
354
+ ```
355
+ import type {KeysOfUnion} from 'type-fest';
356
+
357
+ type A = {
358
+ common: string;
359
+ a: number;
360
+ };
361
+
362
+ type B = {
363
+ common: string;
364
+ b: string;
365
+ };
366
+
367
+ type C = {
368
+ common: string;
369
+ c: boolean;
370
+ };
371
+
372
+ type Union = A | B | C;
373
+
374
+ type CommonKeys = keyof Union;
375
+ //=> 'common'
376
+
377
+ type AllKeys = KeysOfUnion<Union>;
378
+ //=> 'common' | 'a' | 'b' | 'c'
379
+ ```
380
+
381
+ @category Object
382
+ */
383
+ type KeysOfUnion<ObjectType> =
384
+ // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
385
+ keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
386
+ //#endregion
387
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-any.d.ts
388
+ /**
389
+ Returns a boolean for whether the given type is `any`.
390
+
391
+ @link https://stackoverflow.com/a/49928360/1490091
392
+
393
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
394
+
395
+ @example
396
+ ```
397
+ import type {IsAny} from 'type-fest';
398
+
399
+ const typedObject = {a: 1, b: 2} as const;
400
+ const anyObject: any = {a: 1, b: 2};
401
+
402
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
403
+ return object[key];
404
+ }
405
+
406
+ const typedA = get(typedObject, 'a');
407
+ //=> 1
408
+
409
+ const anyA = get(anyObject, 'a');
410
+ //=> any
411
+ ```
412
+
413
+ @category Type Guard
414
+ @category Utilities
415
+ */
416
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
417
+ //#endregion
418
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-optional-key-of.d.ts
419
+ /**
420
+ Returns a boolean for whether the given key is an optional key of type.
421
+
422
+ This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
423
+
424
+ @example
425
+ ```
426
+ import type {IsOptionalKeyOf} from 'type-fest';
427
+
428
+ type User = {
429
+ name: string;
430
+ surname: string;
431
+
432
+ luckyNumber?: number;
433
+ };
434
+
435
+ type Admin = {
436
+ name: string;
437
+ surname?: string;
438
+ };
439
+
440
+ type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
441
+ //=> true
442
+
443
+ type T2 = IsOptionalKeyOf<User, 'name'>;
444
+ //=> false
445
+
446
+ type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
447
+ //=> boolean
448
+
449
+ type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
450
+ //=> false
451
+
452
+ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
453
+ //=> boolean
454
+ ```
455
+
456
+ @category Type Guard
457
+ @category Utilities
458
+ */
459
+ type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
460
+ //#endregion
461
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/optional-keys-of.d.ts
462
+ /**
463
+ Extract all optional keys from the given type.
464
+
465
+ This is useful when you want to create a new type that contains different type values for the optional keys only.
466
+
467
+ @example
468
+ ```
469
+ import type {OptionalKeysOf, Except} from 'type-fest';
470
+
471
+ type User = {
472
+ name: string;
473
+ surname: string;
474
+
475
+ luckyNumber?: number;
476
+ };
477
+
478
+ const REMOVE_FIELD = Symbol('remove field symbol');
479
+ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
480
+ [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
481
+ };
482
+
483
+ const update1: UpdateOperation<User> = {
484
+ name: 'Alice',
485
+ };
486
+
487
+ const update2: UpdateOperation<User> = {
488
+ name: 'Bob',
489
+ luckyNumber: REMOVE_FIELD,
490
+ };
491
+ ```
492
+
493
+ @category Utilities
494
+ */
495
+ type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
496
+ ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never; }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
497
+ : never; // Should never happen
498
+ //#endregion
499
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/required-keys-of.d.ts
500
+ /**
501
+ Extract all required keys from the given type.
502
+
503
+ This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
504
+
505
+ @example
506
+ ```
507
+ import type {RequiredKeysOf} from 'type-fest';
508
+
509
+ declare function createValidation<
510
+ Entity extends object,
511
+ Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
512
+ >(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
513
+
514
+ type User = {
515
+ name: string;
516
+ surname: string;
517
+ luckyNumber?: number;
518
+ };
519
+
520
+ const validator1 = createValidation<User>('name', value => value.length < 25);
521
+ const validator2 = createValidation<User>('surname', value => value.length < 25);
522
+
523
+ // @ts-expect-error
524
+ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
525
+ // Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
526
+ ```
527
+
528
+ @category Utilities
529
+ */
530
+ type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
531
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
532
+ //#endregion
533
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-never.d.ts
534
+ /**
535
+ Returns a boolean for whether the given type is `never`.
536
+
537
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
538
+ @link https://stackoverflow.com/a/53984913/10292952
539
+ @link https://www.zhenghao.io/posts/ts-never
540
+
541
+ Useful in type utilities, such as checking if something does not occur.
542
+
543
+ @example
544
+ ```
545
+ import type {IsNever, And} from 'type-fest';
546
+
547
+ type A = IsNever<never>;
548
+ //=> true
549
+
550
+ type B = IsNever<any>;
551
+ //=> false
552
+
553
+ type C = IsNever<unknown>;
554
+ //=> false
555
+
556
+ type D = IsNever<never[]>;
557
+ //=> false
558
+
559
+ type E = IsNever<object>;
560
+ //=> false
561
+
562
+ type F = IsNever<string>;
563
+ //=> false
564
+ ```
565
+
566
+ @example
567
+ ```
568
+ import type {IsNever} from 'type-fest';
569
+
570
+ type IsTrue<T> = T extends true ? true : false;
571
+
572
+ // When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
573
+ type A = IsTrue<never>;
574
+ //=> never
575
+
576
+ // If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
577
+ type IsTrueFixed<T> =
578
+ IsNever<T> extends true ? false : T extends true ? true : false;
579
+
580
+ type B = IsTrueFixed<never>;
581
+ //=> false
582
+ ```
583
+
584
+ @category Type Guard
585
+ @category Utilities
586
+ */
587
+ type IsNever<T> = [T] extends [never] ? true : false;
588
+ //#endregion
589
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/if.d.ts
590
+ /**
591
+ An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
592
+
593
+ Use-cases:
594
+ - You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
595
+
596
+ Note:
597
+ - Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
598
+ - Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
599
+
600
+ @example
601
+ ```
602
+ import type {If} from 'type-fest';
603
+
604
+ type A = If<true, 'yes', 'no'>;
605
+ //=> 'yes'
606
+
607
+ type B = If<false, 'yes', 'no'>;
608
+ //=> 'no'
609
+
610
+ type C = If<boolean, 'yes', 'no'>;
611
+ //=> 'yes' | 'no'
612
+
613
+ type D = If<any, 'yes', 'no'>;
614
+ //=> 'yes' | 'no'
615
+
616
+ type E = If<never, 'yes', 'no'>;
617
+ //=> 'no'
618
+ ```
619
+
620
+ @example
621
+ ```
622
+ import type {If, IsAny, IsNever} from 'type-fest';
623
+
624
+ type A = If<IsAny<unknown>, 'is any', 'not any'>;
625
+ //=> 'not any'
626
+
627
+ type B = If<IsNever<never>, 'is never', 'not never'>;
628
+ //=> 'is never'
629
+ ```
630
+
631
+ @example
632
+ ```
633
+ import type {If, IsEqual} from 'type-fest';
634
+
635
+ type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
636
+
637
+ type A = IfEqual<string, string, 'equal', 'not equal'>;
638
+ //=> 'equal'
639
+
640
+ type B = IfEqual<string, number, 'equal', 'not equal'>;
641
+ //=> 'not equal'
642
+ ```
643
+
644
+ Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
645
+
646
+ @example
647
+ ```
648
+ import type {If, IsEqual, StringRepeat} from 'type-fest';
649
+
650
+ type HundredZeroes = StringRepeat<'0', 100>;
651
+
652
+ // The following implementation is not tail recursive
653
+ type Includes<S extends string, Char extends string> =
654
+ S extends `${infer First}${infer Rest}`
655
+ ? If<IsEqual<First, Char>,
656
+ 'found',
657
+ Includes<Rest, Char>>
658
+ : 'not found';
659
+
660
+ // Hence, instantiations with long strings will fail
661
+ // @ts-expect-error
662
+ type Fails = Includes<HundredZeroes, '1'>;
663
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
664
+ // Error: Type instantiation is excessively deep and possibly infinite.
665
+
666
+ // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
667
+ type IncludesWithoutIf<S extends string, Char extends string> =
668
+ S extends `${infer First}${infer Rest}`
669
+ ? IsEqual<First, Char> extends true
670
+ ? 'found'
671
+ : IncludesWithoutIf<Rest, Char>
672
+ : 'not found';
673
+
674
+ // Now, instantiations with long strings will work
675
+ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
676
+ //=> 'not found'
677
+ ```
678
+
679
+ @category Type Guard
680
+ @category Utilities
681
+ */
682
+ type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
683
+ //#endregion
684
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/unknown-array.d.ts
685
+ /**
686
+ Represents an array with `unknown` value.
687
+
688
+ Use case: You want a type that all arrays can be assigned to, but you don't care about the value.
689
+
690
+ @example
691
+ ```
692
+ import type {UnknownArray} from 'type-fest';
693
+
694
+ type IsArray<T> = T extends UnknownArray ? true : false;
695
+
696
+ type A = IsArray<['foo']>;
697
+ //=> true
698
+
699
+ type B = IsArray<readonly number[]>;
700
+ //=> true
701
+
702
+ type C = IsArray<string>;
703
+ //=> false
704
+ ```
705
+
706
+ @category Type
707
+ @category Array
708
+ */
709
+ type UnknownArray = readonly unknown[];
710
+ //#endregion
711
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/type.d.ts
712
+ /**
713
+ Returns a boolean for whether A is false.
714
+
715
+ @example
716
+ ```
717
+ type A = Not<true>;
718
+ //=> false
719
+
720
+ type B = Not<false>;
721
+ //=> true
722
+ ```
723
+ */
724
+ type Not<A extends boolean> = A extends true ? false : A extends false ? true : never;
725
+ /**
726
+ An if-else-like type that resolves depending on whether the given type is `any` or `never`.
727
+
728
+ @example
729
+ ```
730
+ // When `T` is neither `any` nor `never` (like `string`) => Returns `IfNot` branch
731
+ type A = IfNotAnyOrNever<string, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
732
+ //=> 'VALID'
733
+
734
+ // When `T` is `any` => Returns `IfAny` branch
735
+ type B = IfNotAnyOrNever<any, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
736
+ //=> 'IS_ANY'
737
+
738
+ // When `T` is `never` => Returns `IfNever` branch
739
+ type C = IfNotAnyOrNever<never, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
740
+ //=> 'IS_NEVER'
741
+ ```
742
+
743
+ Note: Wrapping a tail-recursive type with `IfNotAnyOrNever` makes the implementation non-tail-recursive. To fix this, move the recursion into a helper type. Refer to the following example:
744
+
745
+ @example
746
+ ```ts
747
+ import type {StringRepeat} from 'type-fest';
748
+
749
+ type NineHundredNinetyNineSpaces = StringRepeat<' ', 999>;
750
+
751
+ // The following implementation is not tail recursive
752
+ type TrimLeft<S extends string> = IfNotAnyOrNever<S, {ifNot: S extends ` ${infer R}` ? TrimLeft<R> : S}>;
753
+
754
+ // Hence, instantiations with long strings will fail
755
+ // @ts-expect-error
756
+ type T1 = TrimLeft<NineHundredNinetyNineSpaces>;
757
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
758
+ // Error: Type instantiation is excessively deep and possibly infinite.
759
+
760
+ // To fix this, move the recursion into a helper type
761
+ type TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, {ifNot: _TrimLeftOptimised<S>}>;
762
+
763
+ type _TrimLeftOptimised<S extends string> = S extends ` ${infer R}` ? _TrimLeftOptimised<R> : S;
764
+
765
+ type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
766
+ //=> ''
767
+ ```
768
+ */
769
+ type IfNotAnyOrNever<T, Cases extends {
770
+ ifNot: unknown;
771
+ ifAny?: unknown;
772
+ ifNever?: unknown;
773
+ }> = IsAny<T> extends true ? 'ifAny' extends keyof Cases ? Cases['ifAny'] : any : IsNever<T> extends true ? 'ifNever' extends keyof Cases ? Cases['ifNever'] : never : Cases['ifNot'];
774
+ /**
775
+ Indicates the value of `exactOptionalPropertyTypes` compiler option.
776
+ */
777
+ type IsExactOptionalPropertyTypesEnabled = [(string | undefined)?] extends [string?] ? false : true;
778
+ //#endregion
779
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/array.d.ts
780
+ /**
781
+ Transforms a tuple type by replacing it's rest element with a single element that has the same type as the rest element, while keeping all the non-rest elements intact.
782
+
783
+ @example
784
+ ```
785
+ type A = CollapseRestElement<[string, string, ...number[]]>;
786
+ //=> [string, string, number]
787
+
788
+ type B = CollapseRestElement<[...string[], number, number]>;
789
+ //=> [string, number, number]
790
+
791
+ type C = CollapseRestElement<[string, string, ...Array<number | bigint>]>;
792
+ //=> [string, string, number | bigint]
793
+
794
+ type D = CollapseRestElement<[string, number]>;
795
+ //=> [string, number]
796
+ ```
797
+
798
+ Note: Optional modifiers (`?`) are removed from elements unless the `exactOptionalPropertyTypes` compiler option is disabled. When disabled, there's an additional `| undefined` for optional elements.
799
+
800
+ @example
801
+ ```
802
+ // `exactOptionalPropertyTypes` enabled
803
+ type A = CollapseRestElement<[string?, string?, ...number[]]>;
804
+ //=> [string, string, number]
805
+
806
+ // `exactOptionalPropertyTypes` disabled
807
+ type B = CollapseRestElement<[string?, string?, ...number[]]>;
808
+ //=> [string | undefined, string | undefined, number]
809
+ ```
810
+ */
811
+ type CollapseRestElement<TArray extends UnknownArray> = IfNotAnyOrNever<TArray, {
812
+ ifNot: _CollapseRestElement<TArray>;
813
+ }>;
814
+ type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extends UnknownArray = [], BackwardAccumulator extends UnknownArray = []> = TArray extends UnknownArray // For distributing `TArray`
815
+ ? '0' extends keyof TArray ?
816
+ // Enters this branch, if `TArray` starts with a non-rest element (e.g., `[string, number]` or `[string, ...number[]]`).
817
+ TArray extends readonly [(infer First)?, ...infer Rest] ? _CollapseRestElement<Rest, [...ForwardAccumulator,
818
+ // A tuple allows fewer than one element only when its first element is optional. Written in exactly this shape because equivalent ones, such as `[] extends TArray`, are several times slower.
819
+ TArray extends readonly [unknown, ...unknown[]] ? First : If<IsExactOptionalPropertyTypesEnabled, First, First | undefined> // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.
820
+ ], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
821
+ :
822
+ // Enters this branch, if `TArray` is empty (e.g., []),
823
+ // or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
824
+ TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.
825
+ : TArray extends readonly [] ? [...ForwardAccumulator, ...BackwardAccumulator] : [...ForwardAccumulator, TArray[number], ...BackwardAccumulator] // Add the rest element between the accumulated elements.
826
+ : never; // Should never happen
827
+ //#endregion
828
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/characters.d.ts
829
+ type Whitespace = '\t' // '\t'
830
+ | '\n' // '\n'
831
+ | '\v' // '\v'
832
+ | '\f' // '\f'
833
+ | '\r' // '\r'
834
+ | ' ' // ' '
835
+ | '…' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | ' ' | '
' | '
' | ' ' | ' ' | ' ' | '';
836
+ type WordSeparators = '-' | '_' | Whitespace;
837
+ type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~';
838
+ //#endregion
839
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/simplify.d.ts
840
+ /**
841
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
842
+
843
+ @example
844
+ ```
845
+ import type {Simplify} from 'type-fest';
846
+
847
+ type PositionProps = {
848
+ top: number;
849
+ left: number;
850
+ };
851
+
852
+ type SizeProps = {
853
+ width: number;
854
+ height: number;
855
+ };
856
+
857
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
858
+ type Props = Simplify<PositionProps & SizeProps>;
859
+ ```
860
+
861
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
862
+
863
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
864
+
865
+ @example
866
+ ```
867
+ import type {Simplify} from 'type-fest';
868
+
869
+ interface SomeInterface {
870
+ foo: number;
871
+ bar?: string;
872
+ baz: number | undefined;
873
+ }
874
+
875
+ type SomeType = {
876
+ foo: number;
877
+ bar?: string;
878
+ baz: number | undefined;
879
+ };
880
+
881
+ const literal = {foo: 123, bar: 'hello', baz: 456};
882
+ const someType: SomeType = literal;
883
+ const someInterface: SomeInterface = literal;
884
+
885
+ declare function fn(object: Record<string, unknown>): void;
886
+
887
+ fn(literal); // Good: literal object type is sealed
888
+ fn(someType); // Good: type is sealed
889
+ // @ts-expect-error
890
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
891
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
892
+ ```
893
+
894
+ @link https://github.com/microsoft/TypeScript/issues/15300
895
+ @see {@link SimplifyDeep}
896
+ @category Object
897
+ */
898
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
899
+ //#endregion
900
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-equal.d.ts
901
+ /**
902
+ Returns a boolean for whether the two given types are equal.
903
+
904
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
905
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
906
+
907
+ Use-cases:
908
+ - If you want to make a conditional branch based on the result of a comparison of two types.
909
+
910
+ @example
911
+ ```
912
+ import type {IsEqual} from 'type-fest';
913
+
914
+ // This type returns a boolean for whether the given array includes the given item.
915
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
916
+ type Includes<Value extends readonly any[], Item> =
917
+ Value extends readonly [Value[0], ...infer rest]
918
+ ? IsEqual<Value[0], Item> extends true
919
+ ? true
920
+ : Includes<rest, Item>
921
+ : false;
922
+ ```
923
+
924
+ @category Type Guard
925
+ @category Utilities
926
+ */
927
+ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
928
+ // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
929
+ type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
930
+ //#endregion
931
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/omit-index-signature.d.ts
932
+ /**
933
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
934
+
935
+ This is the counterpart of `PickIndexSignature`.
936
+
937
+ Use-cases:
938
+ - Remove overly permissive signatures from third-party types.
939
+
940
+ This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
941
+
942
+ It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
943
+
944
+ (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
945
+
946
+ ```
947
+ const indexed: Record<string, unknown> = {}; // Allowed
948
+
949
+ // @ts-expect-error
950
+ const keyed: Record<'foo', unknown> = {}; // Error
951
+ // TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
952
+ ```
953
+
954
+ Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
955
+
956
+ ```
957
+ type Indexed = {} extends Record<string, unknown>
958
+ ? '✅ `{}` is assignable to `Record<string, unknown>`'
959
+ : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
960
+
961
+ type IndexedResult = Indexed;
962
+ //=> '✅ `{}` is assignable to `Record<string, unknown>`'
963
+
964
+ type Keyed = {} extends Record<'foo' | 'bar', unknown>
965
+ ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
966
+ : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
967
+
968
+ type KeyedResult = Keyed;
969
+ //=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
970
+ ```
971
+
972
+ Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
973
+
974
+ ```
975
+ type OmitIndexSignature<ObjectType> = {
976
+ [KeyType in keyof ObjectType // Map each key of `ObjectType`...
977
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
978
+ };
979
+ ```
980
+
981
+ ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
982
+
983
+ ```
984
+ type OmitIndexSignature<ObjectType> = {
985
+ [KeyType in keyof ObjectType
986
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
987
+ as {} extends Record<KeyType, unknown>
988
+ ? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
989
+ : KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
990
+ ]: ObjectType[KeyType];
991
+ };
992
+ ```
993
+
994
+ If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
995
+
996
+ @example
997
+ ```
998
+ import type {OmitIndexSignature} from 'type-fest';
999
+
1000
+ type Example = {
1001
+ // These index signatures will be removed.
1002
+ [x: string]: any;
1003
+ [x: number]: any;
1004
+ [x: symbol]: any;
1005
+ [x: `head-${string}`]: string;
1006
+ [x: `${string}-tail`]: string;
1007
+ [x: `head-${string}-tail`]: string;
1008
+ [x: `${bigint}`]: string;
1009
+ [x: `embedded-${number}`]: string;
1010
+
1011
+ // These explicitly defined keys will remain.
1012
+ foo: 'bar';
1013
+ qux?: 'baz';
1014
+ };
1015
+
1016
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
1017
+ //=> {foo: 'bar'; qux?: 'baz'}
1018
+ ```
1019
+
1020
+ @see {@link PickIndexSignature}
1021
+ @category Object
1022
+ */
1023
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
1024
+ //#endregion
1025
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/pick-index-signature.d.ts
1026
+ /**
1027
+ Pick only index signatures from the given object type, leaving out all explicitly defined properties.
1028
+
1029
+ This is the counterpart of `OmitIndexSignature`.
1030
+
1031
+ @example
1032
+ ```
1033
+ import type {PickIndexSignature} from 'type-fest';
1034
+
1035
+ declare const symbolKey: unique symbol;
1036
+
1037
+ type Example = {
1038
+ // These index signatures will remain.
1039
+ [x: string]: unknown;
1040
+ [x: number]: unknown;
1041
+ [x: symbol]: unknown;
1042
+ [x: `head-${string}`]: string;
1043
+ [x: `${string}-tail`]: string;
1044
+ [x: `head-${string}-tail`]: string;
1045
+ [x: `${bigint}`]: string;
1046
+ [x: `embedded-${number}`]: string;
1047
+
1048
+ // These explicitly defined keys will be removed.
1049
+ ['kebab-case-key']: string;
1050
+ [symbolKey]: string;
1051
+ foo: 'bar';
1052
+ qux?: 'baz';
1053
+ };
1054
+
1055
+ type ExampleIndexSignature = PickIndexSignature<Example>;
1056
+ // {
1057
+ // [x: string]: unknown;
1058
+ // [x: number]: unknown;
1059
+ // [x: symbol]: unknown;
1060
+ // [x: `head-${string}`]: string;
1061
+ // [x: `${string}-tail`]: string;
1062
+ // [x: `head-${string}-tail`]: string;
1063
+ // [x: `${bigint}`]: string;
1064
+ // [x: `embedded-${number}`]: string;
1065
+ // }
1066
+ ```
1067
+
1068
+ @see {@link OmitIndexSignature}
1069
+ @category Object
1070
+ */
1071
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
1072
+ //#endregion
1073
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/merge.d.ts
1074
+ // Merges two objects without worrying about index signatures.
1075
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
1076
+ /**
1077
+ Merge two types into a new type. Keys of the second type overrides keys of the first type.
1078
+
1079
+ This is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`.
1080
+
1081
+ @example
1082
+ ```
1083
+ import type {Merge} from 'type-fest';
1084
+
1085
+ type Foo = {
1086
+ a: string;
1087
+ b: number;
1088
+ };
1089
+
1090
+ type Bar = {
1091
+ a: number; // Conflicts with Foo['a']
1092
+ c: boolean;
1093
+ };
1094
+
1095
+ // With `&`, `a` becomes `string & number` which is `never`. Not what you want.
1096
+ type WithIntersection = (Foo & Bar)['a'];
1097
+ //=> never
1098
+
1099
+ // With `Merge`, `a` is cleanly overridden to `number`.
1100
+ type WithMerge = Merge<Foo, Bar>['a'];
1101
+ //=> number
1102
+ ```
1103
+
1104
+ @example
1105
+ ```
1106
+ import type {Merge} from 'type-fest';
1107
+
1108
+ type Foo = {
1109
+ [x: string]: unknown;
1110
+ [x: number]: unknown;
1111
+ foo: string;
1112
+ bar: symbol;
1113
+ };
1114
+
1115
+ type Bar = {
1116
+ [x: number]: number;
1117
+ [x: symbol]: unknown;
1118
+ bar: Date;
1119
+ baz: boolean;
1120
+ };
1121
+
1122
+ export type FooBar = Merge<Foo, Bar>;
1123
+ //=> {
1124
+ // [x: string]: unknown;
1125
+ // [x: number]: number;
1126
+ // [x: symbol]: unknown;
1127
+ // foo: string;
1128
+ // bar: Date;
1129
+ // baz: boolean;
1130
+ // }
1131
+ ```
1132
+
1133
+ Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
1134
+
1135
+ @see {@link ObjectMerge}
1136
+ @category Object
1137
+ */
1138
+ type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
1139
+ ? Source extends unknown // For distributing `Source`
1140
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
1141
+ : never; // Should never happen
1142
+ type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
1143
+ //#endregion
1144
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/trim.d.ts
1145
+ /**
1146
+ Remove spaces from the left side.
1147
+ */
1148
+ type TrimLeft<V extends string> = V extends `${Whitespace}${infer R}` ? TrimLeft<R> : V;
1149
+ /**
1150
+ Remove spaces from the right side.
1151
+ */
1152
+ type TrimRight<V extends string> = V extends `${infer R}${Whitespace}` ? TrimRight<R> : V;
1153
+ /**
1154
+ Remove leading and trailing spaces from a string.
1155
+
1156
+ @example
1157
+ ```
1158
+ import type {Trim} from 'type-fest';
1159
+
1160
+ type Example = Trim<' foo '>;
1161
+ //=> 'foo'
1162
+ ```
1163
+
1164
+ @category String
1165
+ @category Template literal
1166
+ */
1167
+ type Trim<V extends string> = TrimLeft<TrimRight<V>>;
1168
+ //#endregion
1169
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/some-extend.d.ts
1170
+ /**
1171
+ @see {@link SomeExtend}
1172
+ */
1173
+ type SomeExtendOptions = {
1174
+ /**
1175
+ Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1176
+
1177
+ - When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
1178
+ - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1179
+
1180
+ @default true
1181
+
1182
+ @example
1183
+ ```
1184
+ import type {SomeExtend} from 'type-fest';
1185
+
1186
+ type A = SomeExtend<[1, 2, never], string, {strictNever: true}>;
1187
+ //=> false
1188
+
1189
+ type B = SomeExtend<[1, 2, never], string, {strictNever: false}>;
1190
+ //=> true
1191
+
1192
+ type C = SomeExtend<[1, never], never, {strictNever: true}>;
1193
+ //=> true
1194
+
1195
+ type D = SomeExtend<[1, never], never, {strictNever: false}>;
1196
+ //=> true
1197
+
1198
+ type E = SomeExtend<[never], any, {strictNever: true}>;
1199
+ //=> true
1200
+
1201
+ type F = SomeExtend<[never], any, {strictNever: false}>;
1202
+ //=> true
1203
+ ```
1204
+ */
1205
+ strictNever?: boolean;
1206
+ };
1207
+ type DefaultSomeExtendOptions = {
1208
+ strictNever: true;
1209
+ };
1210
+ /**
1211
+ Returns a boolean for whether some element in an array type extends another type.
1212
+
1213
+ @example
1214
+ ```
1215
+ import type {SomeExtend} from 'type-fest';
1216
+
1217
+ type A = SomeExtend<['1', '2', 3], number>;
1218
+ //=> true
1219
+
1220
+ type B = SomeExtend<[1, 2, 3], string>;
1221
+ //=> false
1222
+
1223
+ type C = SomeExtend<[string, number | string], number>;
1224
+ //=> boolean
1225
+
1226
+ type D = SomeExtend<[true, boolean, true], false>;
1227
+ //=> boolean
1228
+ ```
1229
+
1230
+ Note: Behaviour of optional elements depend on the `exactOptionalPropertyTypes` compiler option. When the option is disabled, the target type must include `undefined` for a successful match.
1231
+
1232
+ ```
1233
+ // @exactOptionalPropertyTypes: true
1234
+ import type {SomeExtend} from 'type-fest';
1235
+
1236
+ type A = SomeExtend<[1?, 2?, '3'?], string>;
1237
+ //=> true
1238
+ ```
1239
+
1240
+ ```
1241
+ // @exactOptionalPropertyTypes: false
1242
+ import type {SomeExtend} from 'type-fest';
1243
+
1244
+ type A = SomeExtend<[1?, 2?, '3'?], string>;
1245
+ //=> boolean
1246
+
1247
+ type B = SomeExtend<[1?, 2?, '3'?], string | undefined>;
1248
+ //=> true
1249
+ ```
1250
+
1251
+ @see {@link SomeExtendOptions}
1252
+
1253
+ @category Utilities
1254
+ @category Array
1255
+ */
1256
+ type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> = IfNotAnyOrNever<CollapseRestElement<TArray>, {
1257
+ ifNot: _SomeExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<SomeExtendOptions, DefaultSomeExtendOptions, Options>>;
1258
+ ifAny: false;
1259
+ ifNever: false;
1260
+ }>;
1261
+ // Kept free of `IfNotAnyOrNever` so that it stays tail-recursive, which allows it to handle long arrays.
1262
+ type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
1263
+ // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
1264
+ true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false;
1265
+ //#endregion
1266
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/or-all.d.ts
1267
+ /**
1268
+ Returns a boolean for whether any of the given elements is `true`.
1269
+
1270
+ Use-cases:
1271
+ - Check if at least one condition in a list of booleans is met.
1272
+
1273
+ @example
1274
+ ```
1275
+ import type {OrAll} from 'type-fest';
1276
+
1277
+ type FFT = OrAll<[false, false, true]>;
1278
+ //=> true
1279
+
1280
+ type FFF = OrAll<[false, false, false]>;
1281
+ //=> false
1282
+ ```
1283
+
1284
+ Note: When `boolean` is passed as an element, it is distributed into separate cases, and the final result is a union of those cases.
1285
+ For example, `OrAll<[false, boolean]>` expands to `OrAll<[false, true]> | OrAll<[false, false]>`, which simplifies to `true | false` (i.e., `boolean`).
1286
+
1287
+ @example
1288
+ ```
1289
+ import type {OrAll} from 'type-fest';
1290
+
1291
+ type A = OrAll<[false, boolean]>;
1292
+ //=> boolean
1293
+
1294
+ type B = OrAll<[true, boolean]>;
1295
+ //=> true
1296
+ ```
1297
+
1298
+ Note: If `never` is passed as an element, it is treated as `false` and the result is computed accordingly.
1299
+
1300
+ @example
1301
+ ```
1302
+ import type {OrAll} from 'type-fest';
1303
+
1304
+ type A = OrAll<[never, never, true]>;
1305
+ //=> true
1306
+
1307
+ type B = OrAll<[never, never, false]>;
1308
+ //=> false
1309
+
1310
+ type C = OrAll<[never, never, never]>;
1311
+ //=> false
1312
+
1313
+ type D = OrAll<[never, never, boolean]>;
1314
+ //=> boolean
1315
+ ```
1316
+
1317
+ Note: If `any` is passed as an element, it is treated as `boolean` and the result is computed accordingly.
1318
+
1319
+ @example
1320
+ ```
1321
+ import type {OrAll} from 'type-fest';
1322
+
1323
+ type A = OrAll<[false, any]>;
1324
+ //=> boolean
1325
+
1326
+ type B = OrAll<[true, any]>;
1327
+ //=> true
1328
+ ```
1329
+
1330
+ Note: `OrAll<[]>` evaluates to `false` because there are no `true` elements in an empty tuple. See [Wikipedia: Clause (logic) > Empty clauses](https://en.wikipedia.org/wiki/Clause_(logic)#Empty_clauses:~:text=The%20truth%20evaluation%20of%20an%20empty%20disjunctive%20clause%20is%20always%20false.).
1331
+
1332
+ @see {@link Or}
1333
+ @see {@link AndAll}
1334
+ */
1335
+ type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;
1336
+ //#endregion
1337
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/or.d.ts
1338
+ /**
1339
+ Returns a boolean for whether either of two given types is `true`.
1340
+
1341
+ Use-case: Constructing complex conditional types where at least one condition must be satisfied.
1342
+
1343
+ @example
1344
+ ```
1345
+ import type {Or} from 'type-fest';
1346
+
1347
+ type TT = Or<true, true>;
1348
+ //=> true
1349
+
1350
+ type TF = Or<true, false>;
1351
+ //=> true
1352
+
1353
+ type FT = Or<false, true>;
1354
+ //=> true
1355
+
1356
+ type FF = Or<false, false>;
1357
+ //=> false
1358
+ ```
1359
+
1360
+ Note: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.
1361
+ For example, `Or<false, boolean>` expands to `Or<false, true> | Or<false, false>`, which simplifies to `true | false` (i.e., `boolean`).
1362
+
1363
+ @example
1364
+ ```
1365
+ import type {Or} from 'type-fest';
1366
+
1367
+ type A = Or<false, boolean>;
1368
+ //=> boolean
1369
+
1370
+ type B = Or<boolean, false>;
1371
+ //=> boolean
1372
+
1373
+ type C = Or<true, boolean>;
1374
+ //=> true
1375
+
1376
+ type D = Or<boolean, true>;
1377
+ //=> true
1378
+
1379
+ type E = Or<boolean, boolean>;
1380
+ //=> boolean
1381
+ ```
1382
+
1383
+ Note: If `never` is passed as an argument, it is treated as `false` and the result is computed accordingly.
1384
+
1385
+ @example
1386
+ ```
1387
+ import type {Or} from 'type-fest';
1388
+
1389
+ type A = Or<true, never>;
1390
+ //=> true
1391
+
1392
+ type B = Or<never, true>;
1393
+ //=> true
1394
+
1395
+ type C = Or<false, never>;
1396
+ //=> false
1397
+
1398
+ type D = Or<never, false>;
1399
+ //=> false
1400
+
1401
+ type E = Or<boolean, never>;
1402
+ //=> boolean
1403
+
1404
+ type F = Or<never, boolean>;
1405
+ //=> boolean
1406
+
1407
+ type G = Or<never, never>;
1408
+ //=> false
1409
+ ```
1410
+
1411
+ @see {@link OrAll}
1412
+ @see {@link And}
1413
+ @see {@link Xor}
1414
+ */
1415
+ type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;
1416
+ //#endregion
1417
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/string.d.ts
1418
+ /**
1419
+ Returns a boolean for whether the given string `S` starts with the given string `SearchString`.
1420
+
1421
+ @example
1422
+ ```
1423
+ type A = StartsWith<'abcde', 'abc'>;
1424
+ //=> true
1425
+
1426
+ type B = StartsWith<'abcde', 'bc'>;
1427
+ //=> false
1428
+
1429
+ type C = StartsWith<string, 'bc'>;
1430
+ //=> never
1431
+
1432
+ type D = StartsWith<'abcde', string>;
1433
+ //=> never
1434
+ ```
1435
+
1436
+ @category String
1437
+ @category Template literal
1438
+ */
1439
+ type StartsWith<S extends string, SearchString extends string> = string extends S | SearchString ? never : S extends `${SearchString}${infer T}` ? true : false;
1440
+ /**
1441
+ Returns a boolean for whether the string is numeric.
1442
+
1443
+ This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/microsoft/TypeScript/issues/46109#issuecomment-930307987).
1444
+ */
1445
+ type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? true : false : false;
1446
+ //#endregion
1447
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/object.d.ts
1448
+ /**
1449
+ Merges user specified options with default options.
1450
+
1451
+ @example
1452
+ ```
1453
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
1454
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
1455
+ type SpecifiedOptions = {leavesOnly: true};
1456
+
1457
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
1458
+ //=> {maxRecursionDepth: 10; leavesOnly: true}
1459
+ ```
1460
+
1461
+ @example
1462
+ ```
1463
+ // Complains if default values are not provided for optional options
1464
+
1465
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
1466
+ type DefaultPathsOptions = {maxRecursionDepth: 10};
1467
+ type SpecifiedOptions = {};
1468
+
1469
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
1470
+ // ~~~~~~~~~~~~~~~~~~~
1471
+ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
1472
+ ```
1473
+
1474
+ @example
1475
+ ```
1476
+ // Complains if an option's default type does not conform to the expected type
1477
+
1478
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
1479
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
1480
+ type SpecifiedOptions = {};
1481
+
1482
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
1483
+ // ~~~~~~~~~~~~~~~~~~~
1484
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
1485
+ ```
1486
+
1487
+ @example
1488
+ ```
1489
+ // Complains if an option's specified type does not conform to the expected type
1490
+
1491
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
1492
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
1493
+ type SpecifiedOptions = {leavesOnly: 'yes'};
1494
+
1495
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
1496
+ // ~~~~~~~~~~~~~~~~
1497
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
1498
+ ```
1499
+ */
1500
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends (infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
1501
+ ) ? Result : never;
1502
+ type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key]; }>>>;
1503
+ /**
1504
+ Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
1505
+
1506
+ Note: This doesn't collapse literals within tagged types. For example, `CollapseLiterals<Tagged<'foo' | (string & {}), 'Tag'>>` returns `("foo" & Tag<"Tag", never>) | (string & Tag<"Tag", never>)` and not `string & Tag<"Tag", never>`.
1507
+
1508
+ Use-case: For collapsing unions created using {@link LiteralUnion}.
1509
+
1510
+ @example
1511
+ ```
1512
+ import type {LiteralUnion} from 'type-fest';
1513
+
1514
+ type A = CollapseLiterals<'foo' | 'bar' | (string & {})>;
1515
+ //=> string
1516
+
1517
+ type B = CollapseLiterals<LiteralUnion<1 | 2 | 3, number>>;
1518
+ //=> number
1519
+
1520
+ type C = CollapseLiterals<LiteralUnion<'onClick' | 'onChange', `on${string}`>>;
1521
+ //=> `on${string}`
1522
+
1523
+ type D = CollapseLiterals<'click' | 'change' | (`on${string}` & {})>;
1524
+ //=> 'click' | 'change' | `on${string}`
1525
+
1526
+ type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined>;
1527
+ //=> string | null | undefined
1528
+ ```
1529
+ */
1530
+ type CollapseLiterals<T> = {} extends T ? T : T extends (infer U) & {} ? U : T;
1531
+ /**
1532
+ Returns the base type of a branded type.
1533
+
1534
+ @example
1535
+ ```
1536
+ type Brand = {readonly __brand: unique symbol};
1537
+
1538
+ type A = UnwrapBrand<string & Brand>;
1539
+ //=> string
1540
+
1541
+ type B = UnwrapBrand<number & Brand>;
1542
+ //=> number
1543
+
1544
+ type C = UnwrapBrand<PropertyKey & Brand>;
1545
+ //=> PropertyKey
1546
+
1547
+ type D = UnwrapBrand<(1 | 200n | 'foo' | 'bar') & Brand>;
1548
+ //=> 1 | 200n | 'foo' | 'bar'
1549
+ ```
1550
+ */
1551
+ type UnwrapBrand<T> = IfNotAnyOrNever<T, {
1552
+ ifNot: _UnwrapBrand<T, Primitive>;
1553
+ }>;
1554
+ type _UnwrapBrand<T, Base> = T extends Primitive ? T extends (infer U) & Pick<T, Exclude<keyof T, KeysOfUnion<Base>>> ? U : T : T;
1555
+ //#endregion
1556
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-string-literal.d.ts
1557
+ /**
1558
+ Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
1559
+
1560
+ The implementation of this type is inspired by the trick mentioned in this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
1561
+
1562
+ @example
1563
+ ```
1564
+ import type {IsStringLiteral} from 'type-fest';
1565
+
1566
+ type A = IsStringLiteral<'foo'>;
1567
+ //=> true
1568
+
1569
+ type B = IsStringLiteral<string>;
1570
+ //=> false
1571
+
1572
+ // String types with infinite set of possible values return `false`
1573
+ type C = IsStringLiteral<`on${string}`>;
1574
+ //=> false
1575
+
1576
+ type D = IsStringLiteral<Uppercase<string>>;
1577
+ //=> false
1578
+
1579
+ type E = IsStringLiteral<'foo' | 'bar' | 'baz'>;
1580
+ //=> true
1581
+
1582
+ type F = IsStringLiteral<'sm' | 'md' | 'lg' | `${number}px`>;
1583
+ //=> boolean
1584
+ ```
1585
+
1586
+ @example
1587
+ ```
1588
+ import type {IsStringLiteral} from 'type-fest';
1589
+
1590
+ type StringLength<S extends string, Counter extends never[] = []> =
1591
+ IsStringLiteral<S> extends true
1592
+ ? S extends `${string}${infer Tail}`
1593
+ ? StringLength<Tail, [...Counter, never]>
1594
+ : Counter['length']
1595
+ : number; // return `number` for non-literal string types
1596
+
1597
+ type L1 = StringLength<'foobar'>;
1598
+ //=> 6
1599
+
1600
+ type L2 = StringLength<Lowercase<string>>;
1601
+ //=> number
1602
+
1603
+ type L3 = StringLength<`${number}`>;
1604
+ //=> number
1605
+ ```
1606
+
1607
+ @category Type Guard
1608
+ @category Utilities
1609
+ */
1610
+ type IsStringLiteral<S> = IfNotAnyOrNever<S, {
1611
+ ifNot: _IsStringLiteral<CollapseLiterals<UnwrapBrand<S>>>;
1612
+ ifAny: false;
1613
+ ifNever: false;
1614
+ }>;
1615
+ type _IsStringLiteral<S> =
1616
+ // If `S` is an infinite string type (e.g., `on${string}`), `Record<S, never>` produces an index signature,
1617
+ // and since `{}` extends index signatures, the result becomes `false`.
1618
+ S extends string ? {} extends Record<S, never> ? false : true : false;
1619
+ //#endregion
1620
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/all-extend.d.ts
1621
+ /**
1622
+ @see {@link AllExtend}
1623
+ */
1624
+ type AllExtendOptions = {
1625
+ /**
1626
+ Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
1627
+
1628
+ - When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
1629
+ - When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
1630
+
1631
+ @default true
1632
+
1633
+ @example
1634
+ ```
1635
+ import type {AllExtend} from 'type-fest';
1636
+
1637
+ type A = AllExtend<[1, 2, never], number, {strictNever: true}>;
1638
+ //=> false
1639
+
1640
+ type B = AllExtend<[1, 2, never], number, {strictNever: false}>;
1641
+ //=> true
1642
+
1643
+ type C = AllExtend<[never, never], never, {strictNever: true}>;
1644
+ //=> true
1645
+
1646
+ type D = AllExtend<[never, never], never, {strictNever: false}>;
1647
+ //=> true
1648
+
1649
+ type E = AllExtend<['a', 'b', never], any, {strictNever: true}>;
1650
+ //=> true
1651
+
1652
+ type F = AllExtend<['a', 'b', never], any, {strictNever: false}>;
1653
+ //=> true
1654
+
1655
+ type G = AllExtend<[never, 1], never, {strictNever: true}>;
1656
+ //=> false
1657
+
1658
+ type H = AllExtend<[never, 1], never, {strictNever: false}>;
1659
+ //=> false
1660
+ ```
1661
+ */
1662
+ strictNever?: boolean;
1663
+ };
1664
+ type DefaultAllExtendOptions = {
1665
+ strictNever: true;
1666
+ };
1667
+ /**
1668
+ Returns a boolean for whether every element in an array type extends another type.
1669
+
1670
+ @example
1671
+ ```
1672
+ import type {AllExtend} from 'type-fest';
1673
+
1674
+ type A = AllExtend<[1, 2, 3], number>;
1675
+ //=> true
1676
+
1677
+ type B = AllExtend<[1, 2, '3'], number>;
1678
+ //=> false
1679
+
1680
+ type C = AllExtend<[number, number | string], number>;
1681
+ //=> boolean
1682
+
1683
+ type D = AllExtend<[true, boolean, true], true>;
1684
+ //=> boolean
1685
+ ```
1686
+
1687
+ Note: Behaviour of optional elements depend on the `exactOptionalPropertyTypes` compiler option. When the option is disabled, the target type must include `undefined` for a successful match.
1688
+
1689
+ ```
1690
+ // @exactOptionalPropertyTypes: true
1691
+ import type {AllExtend} from 'type-fest';
1692
+
1693
+ type A = AllExtend<[1?, 2?, 3?], number>;
1694
+ //=> true
1695
+ ```
1696
+
1697
+ ```
1698
+ // @exactOptionalPropertyTypes: false
1699
+ import type {AllExtend} from 'type-fest';
1700
+
1701
+ type A = AllExtend<[1?, 2?, 3?], number>;
1702
+ //=> boolean
1703
+
1704
+ type B = AllExtend<[1?, 2?, 3?], number | undefined>;
1705
+ //=> true
1706
+ ```
1707
+
1708
+ @see {@link AllExtendOptions}
1709
+
1710
+ @category Utilities
1711
+ @category Array
1712
+ */
1713
+ type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> = IfNotAnyOrNever<CollapseRestElement<TArray>, {
1714
+ ifNot: _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
1715
+ ifAny: false;
1716
+ ifNever: false;
1717
+ }>;
1718
+ // Kept free of `IfNotAnyOrNever` so that it stays tail-recursive, which allows it to handle long arrays.
1719
+ type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true ?
1720
+ // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
1721
+ _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true;
1722
+ //#endregion
1723
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/promisable.d.ts
1724
+ /**
1725
+ Create a type that represents either the value or the value wrapped in `PromiseLike`.
1726
+
1727
+ Use-cases:
1728
+ - A function accepts a callback that may either return a value synchronously or may return a promised value.
1729
+ - This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.
1730
+
1731
+ Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.
1732
+
1733
+ @example
1734
+ ```
1735
+ import type {Promisable} from 'type-fest';
1736
+
1737
+ async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
1738
+ const entry = await getLogEntry();
1739
+ console.log(entry);
1740
+ }
1741
+
1742
+ await logger(() => 'foo');
1743
+ await logger(() => Promise.resolve('bar'));
1744
+ ```
1745
+
1746
+ @category Async
1747
+ */
1748
+ type Promisable<T> = T | PromiseLike<T>;
1749
+ //#endregion
1750
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-lowercase.d.ts
1751
+ /**
1752
+ Returns a boolean for whether the given string literal is lowercase.
1753
+
1754
+ @example
1755
+ ```
1756
+ import type {IsLowercase} from 'type-fest';
1757
+
1758
+ type A = IsLowercase<'abc'>;
1759
+ //=> true
1760
+
1761
+ type B = IsLowercase<'Abc'>;
1762
+ //=> false
1763
+
1764
+ type C = IsLowercase<string>;
1765
+ //=> boolean
1766
+ ```
1767
+ */
1768
+ type IsLowercase<S extends string> = AllExtend<_IsLowercase<S>, true>;
1769
+ /**
1770
+ Loops through each part in the string and returns a boolean array indicating whether each part is lowercase.
1771
+ */
1772
+ type _IsLowercase<S extends string, Accumulator extends boolean[] = []> = S extends `${infer First}${infer Rest}` ? _IsLowercase<Rest, [...Accumulator, IsLowercaseHelper<First>]> : [...Accumulator, IsLowercaseHelper<S>];
1773
+ /**
1774
+ Returns a boolean for whether an individual part of the string is lowercase.
1775
+ */
1776
+ type IsLowercaseHelper<S extends string> = S extends Lowercase<string> ? true : S extends Uppercase<string> | Capitalize<string> | `${string}${Uppercase<string>}${string}` ? false : boolean;
1777
+ //#endregion
1778
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-uppercase.d.ts
1779
+ /**
1780
+ Returns a boolean for whether the given string literal is uppercase.
1781
+
1782
+ @example
1783
+ ```
1784
+ import type {IsUppercase} from 'type-fest';
1785
+
1786
+ type A = IsUppercase<'ABC'>;
1787
+ //=> true
1788
+
1789
+ type B = IsUppercase<'Abc'>;
1790
+ //=> false
1791
+
1792
+ type C = IsUppercase<string>;
1793
+ //=> boolean
1794
+ ```
1795
+ */
1796
+ type IsUppercase<S extends string> = AllExtend<_IsUppercase<S>, true>;
1797
+ /**
1798
+ Loops through each part in the string and returns a boolean array indicating whether each part is uppercase.
1799
+ */
1800
+ type _IsUppercase<S extends string, Accumulator extends boolean[] = []> = S extends `${infer First}${infer Rest}` ? _IsUppercase<Rest, [...Accumulator, IsUppercaseHelper<First>]> : [...Accumulator, IsUppercaseHelper<S>];
1801
+ /**
1802
+ Returns a boolean for whether an individual part of the string is uppercase.
1803
+ */
1804
+ type IsUppercaseHelper<S extends string> = S extends Uppercase<string> ? true : S extends Lowercase<string> | Uncapitalize<string> | `${string}${Lowercase<string>}${string}` ? false : boolean;
1805
+ //#endregion
1806
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/words.d.ts
1807
+ type SkipEmptyWord<Word extends string> = Word extends '' ? [] : [Word];
1808
+ type RemoveLastCharacter<Sentence extends string, Character extends string> = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord<LeftSide> : never;
1809
+ /**
1810
+ Words options.
1811
+
1812
+ @see {@link Words}
1813
+ */
1814
+ type WordsOptions = {
1815
+ /**
1816
+ Split on numeric sequence.
1817
+
1818
+ @default true
1819
+
1820
+ @example
1821
+ ```
1822
+ import type {Words} from 'type-fest';
1823
+
1824
+ type Example1 = Words<'p2pNetwork', {splitOnNumbers: true}>;
1825
+ //=> ['p', '2', 'p', 'Network']
1826
+
1827
+ type Example2 = Words<'p2pNetwork', {splitOnNumbers: false}>;
1828
+ //=> ['p2p', 'Network']
1829
+ ```
1830
+ */
1831
+ splitOnNumbers?: boolean;
1832
+ /**
1833
+ Split on {@link AsciiPunctuation | punctuation characters} (e.g., `#`, `&`, `*`, `:`, `?`, `@`, `~`).
1834
+
1835
+ @example
1836
+ ```
1837
+ import type {Words} from 'type-fest';
1838
+
1839
+ type Example1 = Words<'hello:world', {splitOnPunctuation: true}>;
1840
+ //=> ['hello', 'world']
1841
+
1842
+ type Example2 = Words<'hello:world', {splitOnPunctuation: false}>;
1843
+ //=> ['hello', ':world']
1844
+ ```
1845
+ */
1846
+ splitOnPunctuation?: boolean;
1847
+ };
1848
+ type _DefaultWordsOptions = {
1849
+ splitOnNumbers: true;
1850
+ splitOnPunctuation: false;
1851
+ };
1852
+ /**
1853
+ Split a string similar to Lodash's `_.words()` function.
1854
+
1855
+ - Split on each word that begins with a capital letter.
1856
+ - Split on each {@link WordSeparators}.
1857
+ - Split on each {@link AsciiPunctuation} (if {@link WordsOptions.splitOnPunctuation} is enabled).
1858
+ - Split on numeric sequence.
1859
+
1860
+ @example
1861
+ ```
1862
+ import type {Words} from 'type-fest';
1863
+
1864
+ type Words0 = Words<'helloWorld'>;
1865
+ //=> ['hello', 'World']
1866
+
1867
+ type Words1 = Words<'helloWORLD'>;
1868
+ //=> ['hello', 'WORLD']
1869
+
1870
+ type Words2 = Words<'hello-world'>;
1871
+ //=> ['hello', 'world']
1872
+
1873
+ type Words3 = Words<'--hello the_world'>;
1874
+ //=> ['hello', 'the', 'world']
1875
+
1876
+ type Words4 = Words<'lifeIs42'>;
1877
+ //=> ['life', 'Is', '42']
1878
+
1879
+ type Words5 = Words<'p2pNetwork', {splitOnNumbers: false}>;
1880
+ //=> ['p2p', 'Network']
1881
+
1882
+ type Words6 = Words<'hello:world', {splitOnPunctuation: true}>;
1883
+ //=> ['hello', 'world']
1884
+
1885
+ type Words7 = Words<'hello:world', {splitOnPunctuation: false}>;
1886
+ //=> ['hello', ':world']
1887
+
1888
+ type Words8 = Words<'hello::world', {splitOnPunctuation: true}>;
1889
+ //=> ['hello', 'world']
1890
+ ```
1891
+
1892
+ @category Change case
1893
+ @category Template literal
1894
+ */
1895
+ type Words<Sentence extends string, Options extends WordsOptions = {}> = WordsImplementation<Sentence, ApplyDefaultOptions<WordsOptions, _DefaultWordsOptions, Options>>;
1896
+ type WordsImplementation<Sentence extends string, Options extends Required<WordsOptions>, LastCharacter extends string = '', CurrentWord extends string = ''> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}` ? FirstCharacter extends WordSeparators | (Options['splitOnPunctuation'] extends true ? AsciiPunctuation : never) ?
1897
+ // Skip word separator
1898
+ [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options>] : LastCharacter extends '' ?
1899
+ // Fist char of word
1900
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter> :
1901
+ // Case change: non-numeric to numeric
1902
+ [false, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true ?
1903
+ // Split on number: push word
1904
+ [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] :
1905
+ // No split on number: concat word
1906
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> :
1907
+ // Case change: numeric to non-numeric
1908
+ [true, false] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? Options['splitOnNumbers'] extends true ?
1909
+ // Split on number: push word
1910
+ [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] :
1911
+ // No split on number: concat word
1912
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> :
1913
+ // No case change: concat word
1914
+ [true, true] extends [IsNumeric<LastCharacter>, IsNumeric<FirstCharacter>] ? WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> :
1915
+ // Case change: lower to upper, push word
1916
+ [true, true] extends [IsLowercase<LastCharacter>, IsUppercase<FirstCharacter>] ? [...SkipEmptyWord<CurrentWord>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, FirstCharacter>] :
1917
+ // Case change: upper to lower, brings back the last character, push word
1918
+ [true, true] extends [IsUppercase<LastCharacter>, IsLowercase<FirstCharacter>] ? [...RemoveLastCharacter<CurrentWord, LastCharacter>, ...WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${LastCharacter}${FirstCharacter}`>] :
1919
+ // No case change: concat word
1920
+ WordsImplementation<RemainingCharacters, Options, FirstCharacter, `${CurrentWord}${FirstCharacter}`> : [...SkipEmptyWord<CurrentWord>];
1921
+ //#endregion
1922
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/delimiter-case.d.ts
1923
+ type _DefaultDelimiterCaseOptions = Merge<_DefaultWordsOptions, {
1924
+ splitOnNumbers: false;
1925
+ }>;
1926
+ /**
1927
+ Convert an array of words to delimiter case starting with a delimiter with input capitalization.
1928
+ */
1929
+ type DelimiterCaseFromArray<Words extends string[], Delimiter extends string, OutputString extends string = ''> = Words extends [infer FirstWord extends string, ...infer RemainingWords extends string[]] ? DelimiterCaseFromArray<RemainingWords, Delimiter, OutputString extends '' ? FirstWord : `${OutputString}${StartsWith<FirstWord, AsciiPunctuation> extends true ? '' : Delimiter}${FirstWord}`> : OutputString;
1930
+ /**
1931
+ Convert a string literal to a custom string delimiter casing.
1932
+
1933
+ This can be useful when, for example, converting a camel-cased object property to an oddly cased one.
1934
+
1935
+ @see {@link KebabCase}
1936
+ @see {@link SnakeCase}
1937
+
1938
+ @example
1939
+ ```
1940
+ import type {DelimiterCase} from 'type-fest';
1941
+
1942
+ // Simple
1943
+
1944
+ const someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar';
1945
+ const someVariableNoSplitOnNumbers: DelimiterCase<'p2pNetwork', '#', {splitOnNumbers: false}> = 'p2p#network';
1946
+ const someVariableWithPunctuation: DelimiterCase<'div.card::after', '#', {splitOnPunctuation: true}> = 'div#card#after';
1947
+
1948
+ // Advanced
1949
+
1950
+ type OddlyCasedProperties<T> = {
1951
+ [K in keyof T as DelimiterCase<K, '#'>]: T[K]
1952
+ };
1953
+
1954
+ type SomeOptions = {
1955
+ dryRun: boolean;
1956
+ includeFile: string;
1957
+ foo: number;
1958
+ };
1959
+
1960
+ const rawCliOptions: OddlyCasedProperties<SomeOptions> = {
1961
+ 'dry#run': true,
1962
+ 'include#file': 'bar.js',
1963
+ foo: 123,
1964
+ };
1965
+ ```
1966
+
1967
+ @category Change case
1968
+ @category Template literal
1969
+ */
1970
+ type DelimiterCase<Value, Delimiter extends string, Options extends WordsOptions = {}> = Value extends string ? Delimiter extends string // For distributing `Delimiter`
1971
+ ? IsStringLiteral<Value> extends false ? Value : Lowercase<DelimiterCaseFromArray<Words<Value, ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>, Delimiter>> : never : Value;
1972
+ //#endregion
1973
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/kebab-case.d.ts
1974
+ /**
1975
+ Convert a string literal to kebab-case.
1976
+
1977
+ This can be useful when, for example, converting a camel-cased object property to a kebab-cased CSS class name or a command-line flag.
1978
+
1979
+ @example
1980
+ ```
1981
+ import type {KebabCase} from 'type-fest';
1982
+
1983
+ // Simple
1984
+
1985
+ const someVariable: KebabCase<'fooBar'> = 'foo-bar';
1986
+ const someVariableNoSplitOnNumbers: KebabCase<'p2pNetwork', {splitOnNumbers: false}> = 'p2p-network';
1987
+ const someVariableWithPunctuation: KebabCase<'div.card::after', {splitOnPunctuation: true}> = 'div-card-after';
1988
+
1989
+ // Advanced
1990
+
1991
+ type KebabCasedProperties<T> = {
1992
+ [K in keyof T as KebabCase<K>]: T[K]
1993
+ };
1994
+
1995
+ type CliOptions = {
1996
+ dryRun: boolean;
1997
+ includeFile: string;
1998
+ foo: number;
1999
+ };
2000
+
2001
+ const rawCliOptions: KebabCasedProperties<CliOptions> = {
2002
+ 'dry-run': true,
2003
+ 'include-file': 'bar.js',
2004
+ foo: 123,
2005
+ };
2006
+ ```
2007
+
2008
+ @category Change case
2009
+ @category Template literal
2010
+ */
2011
+ type KebabCase<Value, Options extends WordsOptions = {}> = DelimiterCase<Value, '-', ApplyDefaultOptions<WordsOptions, _DefaultDelimiterCaseOptions, Options>>;
2012
+ //#endregion
2013
+ //#region src/models/shared/ItemMetadataClass.d.ts
2014
+ export interface ItemMetadataClass<TBase extends Class<object>> {
2015
+ new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & ItemMetadata;
2016
+ prototype: InstanceType<TBase> & ItemMetadata;
2017
+ }
2018
+ //#endregion
2019
+ //#region src/models/shared/Serializable.d.ts
2020
+ export declare abstract class Serializable {
2021
+ toJSON(): this;
2022
+ }
2023
+ //#endregion
2024
+ //#region src/models/shared/TakeOne.d.ts
2025
+ export interface TakeOne {
2026
+ <T extends readonly unknown[]>(values: T, index?: number): T[number];
2027
+ <T extends object>(values: T, index: keyof T): T[keyof T];
2028
+ }
2029
+ //#endregion
2030
+ //#region src/util/types/FunctionLike.d.ts
2031
+ export type FunctionLike = ((...args: never) => unknown) | (abstract new (...args: never) => unknown);
2032
+ //#endregion
2033
+ //#region src/util/types/DeepOmit.d.ts
2034
+ export type DeepOmit<T, TKey extends PropertyKey> = T extends DeepOmitKeptValue ? T : T extends readonly unknown[] ? { [K in keyof T]: DeepOmit<T[K], TKey>; } : T extends object ? [keyof T] extends [never] ? T : { [P in keyof T as P extends symbol ? never : P extends TKey ? never : P]: DeepOmit<T[P], TKey>; } : T;
2035
+ type DeepOmitKeptValue = ArrayBufferView | Blob | Date | FunctionLike | Map<unknown, unknown> | Primitive | Promise<unknown> | RegExp | Set<unknown>;
2036
+ //#endregion
2037
+ //#region src/util/types/DeepOptionalUndefined.d.ts
2038
+ export type DeepOptionalUndefined<T> = T extends Date | FunctionLike | Primitive ? T : T extends unknown[] ? { [K in keyof T]: DeepOptionalUndefined<T[K]>; } : T extends object ? { [K in keyof T as undefined extends T[K] ? K : never]?: DeepOptionalUndefined<T[K]>; } & { [K in keyof T as undefined extends T[K] ? never : K]: DeepOptionalUndefined<T[K]>; } extends (infer O) ? { [K in keyof O]: O[K]; } : never : T;
2039
+ //#endregion
2040
+ //#region src/models/shared/ToData.d.ts
2041
+ export type ToData<T> = DeepOptionalUndefined<DeepOmit<T, "toJSON">>;
2042
+ //#endregion
2043
+ //#region src/models/text/DedentOptions.d.ts
2044
+ export interface DedentOptions {
2045
+ alignValues?: boolean;
2046
+ escapeSpecialCharacters?: boolean;
2047
+ trimWhitespace?: boolean;
2048
+ }
2049
+ //#endregion
2050
+ //#region src/models/text/Dedent.d.ts
2051
+ export interface Dedent {
2052
+ (strings: string | TemplateStringsArray, ...values: unknown[]): string;
2053
+ withOptions: (options: DedentOptions) => Dedent;
2054
+ }
2055
+ //#endregion
2056
+ //#region src/models/zod/UniqueArraySchemaKey.d.ts
2057
+ export type UniqueArraySchemaKey<TSchema extends z.ZodType> = TSchema extends z.ZodObject ? keyof TSchema["shape"] & string : keyof z.output<TSchema> & string;
2058
+ //#endregion
2059
+ //#region src/models/zod/CreateUniqueArraySchema.d.ts
2060
+ export type CreateUniqueArraySchema = (<TOutput extends object, TInput, TSchema extends z.ZodType<TOutput, TInput>>(schema: TSchema, key: readonly UniqueArraySchemaKey<TSchema>[] | UniqueArraySchemaKey<TSchema>) => z.ZodArray<TSchema>) & (<TOutput extends Primitive, TInput, TSchema extends z.ZodType<TOutput, TInput>>(schema: TSchema) => z.ZodArray<TSchema>);
2061
+ //#endregion
2062
+ //#region src/services/app/constants.d.ts
2063
+ export declare const MAX_READ_LIMIT = 1e3;
2064
+ export declare const SITE_NAME = "Esposter";
2065
+ export declare const KIBIBYTE: number;
2066
+ export declare const GIBIBYTE: number;
2067
+ //#endregion
2068
+ //#region src/services/error/getResult.d.ts
2069
+ export declare const getResult: <T>(callback: () => T) => Result<T, Error>;
2070
+ //#endregion
2071
+ //#region src/services/error/getResultAsync.d.ts
2072
+ export declare const getResultAsync: <T>(callback: () => Promise<T>) => ResultAsync<T, Error>;
2073
+ //#endregion
2074
+ //#region src/services/error/reportFinalizerError.d.ts
2075
+ export declare const reportFinalizerError: <T, E>(callbackResult: Result<T, E>, finalizerError: unknown) => void;
2076
+ //#endregion
2077
+ //#region src/services/error/toAppError.d.ts
2078
+ export declare const toAppError: (error: unknown) => Error;
2079
+ //#endregion
2080
+ //#region src/services/error/withFinalizer.d.ts
2081
+ export declare const withFinalizer: <T>(callback: () => T, finalizer?: () => void) => T;
2082
+ //#endregion
2083
+ //#region src/services/error/withFinalizerAsync.d.ts
2084
+ export declare const withFinalizerAsync: <T>(callback: () => Promisable<T>, finalizer?: () => Promisable<void>) => Promise<T>;
2085
+ //#endregion
2086
+ //#region src/services/history/createHistory.d.ts
2087
+ export declare const createHistory: <T>(limit: number) => History<T>;
2088
+ //#endregion
2089
+ //#region src/services/history/pushHistory.d.ts
2090
+ export declare const pushHistory: <T>(history: History<T>, entry: T) => History<T>;
2091
+ //#endregion
2092
+ //#region src/services/history/redoHistory.d.ts
2093
+ export declare const redoHistory: <T>(history: History<T>) => HistoryStep<T>;
2094
+ //#endregion
2095
+ //#region src/services/history/undoHistory.d.ts
2096
+ export declare const undoHistory: <T>(history: History<T>) => HistoryStep<T>;
2097
+ //#endregion
2098
+ //#region src/services/indexedDb/getRequestError.d.ts
2099
+ export declare const getRequestError: (request: IDBRequest) => DOMException;
2100
+ //#endregion
2101
+ //#region src/services/indexedDb/getTransactionDone.d.ts
2102
+ export declare const getTransactionDone: (transaction: IDBTransaction) => Promise<void>;
2103
+ //#endregion
2104
+ //#region src/services/indexedDb/getTransactionObjectStore.d.ts
2105
+ export declare const getTransactionObjectStore: <TSchema extends DatabaseSchema, TMode extends IDBTransactionMode>(transaction: IDBTransaction) => <TStoreName extends DatabaseStoreName<TSchema>>(name: TStoreName) => DatabaseObjectStore<TSchema, TStoreName, TMode>;
2106
+ //#endregion
2107
+ //#region src/services/indexedDb/openDatabase.d.ts
2108
+ export declare const openDatabase: <TSchema extends DatabaseSchema = DatabaseSchema>(name: string, version: number, options?: DatabaseOpenOptions<TSchema>) => Promise<Database<TSchema>>;
2109
+ //#endregion
2110
+ //#region src/services/indexedDb/requestToPromise.d.ts
2111
+ export declare const requestToPromise: <TResult>(request: IDBRequest) => Promise<TResult>;
2112
+ //#endregion
2113
+ //#region src/services/indexedDb/wrapDatabase.d.ts
2114
+ export declare const wrapDatabase: <TSchema extends DatabaseSchema = DatabaseSchema>(database: IDBDatabase) => Database<TSchema>;
2115
+ //#endregion
2116
+ //#region src/services/indexedDb/wrapIndex.d.ts
2117
+ export declare const wrapIndex: <TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>, TIndexName extends DatabaseIndexName<TSchema, TStoreName>>(index: IDBIndex) => DatabaseIndex<TSchema, TStoreName, TIndexName>;
2118
+ //#endregion
2119
+ //#region src/services/indexedDb/wrapObjectStore.d.ts
2120
+ export declare const wrapObjectStore: <TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>, TMode extends IDBTransactionMode>(objectStore: IDBObjectStore) => DatabaseObjectStore<TSchema, TStoreName, TMode>;
2121
+ //#endregion
2122
+ //#region src/services/indexedDb/wrapTransaction.d.ts
2123
+ export declare const wrapTransaction: <TSchema extends DatabaseSchema, TStoreName extends DatabaseStoreName<TSchema>, TMode extends IDBTransactionMode>(transaction: IDBTransaction) => DatabaseTransaction<TSchema, TStoreName, TMode>;
2124
+ //#endregion
2125
+ //#region src/services/indexedDb/wrapUpgradeDatabase.d.ts
2126
+ export declare const wrapUpgradeDatabase: <TSchema extends DatabaseSchema = DatabaseSchema>(database: IDBDatabase) => UpgradeDatabase<TSchema>;
2127
+ //#endregion
2128
+ //#region src/services/indexedDb/wrapUpgradeTransaction.d.ts
2129
+ export declare const wrapUpgradeTransaction: <TSchema extends DatabaseSchema>(transaction: IDBTransaction) => DatabaseTransaction<TSchema, DatabaseStoreName<TSchema>, "versionchange">;
2130
+ //#endregion
2131
+ //#region src/services/jsonPatch/addJsonValue.d.ts
2132
+ export declare const addJsonValue: (document: unknown, path: string, value: unknown) => ApplyPatchesResult<unknown>;
2133
+ //#endregion
2134
+ //#region src/services/jsonPatch/applyPatch.d.ts
2135
+ export declare const applyPatch: (document: unknown, operation: JsonPatchOperation) => ApplyPatchesResult<unknown>;
2136
+ //#endregion
2137
+ //#region src/services/jsonPatch/applyPatches.d.ts
2138
+ export declare const applyPatches: <T>(document: T, operations: JsonPatchOperation[]) => ApplyPatchesResult<T>;
2139
+ //#endregion
2140
+ //#region src/services/jsonPatch/constants.d.ts
2141
+ export declare const APPEND_SEGMENT = "-";
2142
+ export declare const JSON_POINTER_REGEX: RegExp;
2143
+ //#endregion
2144
+ //#region src/services/jsonPatch/parseArrayIndex.d.ts
2145
+ export declare const parseArrayIndex: (segment: string, maxIndex: number) => number | undefined;
2146
+ //#endregion
2147
+ //#region src/services/jsonPatch/parseJsonPointer.d.ts
2148
+ export declare const parseJsonPointer: (pointer: string) => string[];
2149
+ //#endregion
2150
+ //#region src/services/jsonPatch/readJsonValue.d.ts
2151
+ export declare const readJsonValue: (document: unknown, segments: string[]) => unknown;
2152
+ //#endregion
2153
+ //#region src/services/jsonPatch/removeJsonValue.d.ts
2154
+ export declare const removeJsonValue: (document: unknown, path: string) => ApplyPatchesResult<unknown>;
2155
+ //#endregion
2156
+ //#region src/services/jsonPatch/toJsonPointer.d.ts
2157
+ export declare const toJsonPointer: (segments: string[]) => string;
2158
+ //#endregion
2159
+ //#region src/services/jsonPatch/updateJsonValue.d.ts
2160
+ export declare const updateJsonValue: (document: unknown, segments: string[], update: (value: unknown) => unknown) => unknown;
2161
+ //#endregion
2162
+ //#region src/services/message/constants.d.ts
2163
+ export declare const MENTION_ID_ATTRIBUTE = "data-id";
2164
+ export declare const MENTION_ITEM_TYPE_ATTRIBUTE = "data-mention-type";
2165
+ export declare const MENTION_LABEL_ATTRIBUTE = "data-label";
2166
+ export declare const MENTION_TYPE_ATTRIBUTE = "data-type";
2167
+ export declare const MENTION_TYPE = "mention";
2168
+ export declare const MENTION_SELECTOR: string;
2169
+ export declare const MENTION_HERE_ID = "@here";
2170
+ export declare const MENTION_EVERYONE_ID = "@everyone";
2171
+ export declare const CUSTOM_EMOJI_ID_ATTRIBUTE = "data-custom-emoji-id";
2172
+ export declare const CUSTOM_EMOJI_NAME_ATTRIBUTE = "data-custom-emoji-name";
2173
+ export declare const SPOILER_ATTRIBUTE = "data-spoiler";
2174
+ export declare const SPOILER_SELECTOR: string;
2175
+ //#endregion
2176
+ //#region src/services/message/getMentions.d.ts
2177
+ export declare const getMentions: (message: string) => HTMLElement[];
2178
+ //#endregion
2179
+ //#region src/services/mime/charset.d.ts
2180
+ export declare const charset: (type: string) => false | string;
2181
+ //#endregion
2182
+ //#region src/services/mime/constants.d.ts
2183
+ export declare const MEDIA_TYPE_REGEX: RegExp;
2184
+ export declare const PATH_SEPARATOR_REGEX: RegExp;
2185
+ export declare const TEXT_MEDIA_TYPE_REGEX: RegExp;
2186
+ export declare const CHARSET_PARAMETER_REGEX: RegExp;
2187
+ export declare const DEFAULT_TEXT_CHARSET = "UTF-8";
2188
+ export declare const FacetScoreMap: ReadonlyMap<string, number>;
2189
+ export declare const DEFAULT_FACET_SCORE = 900;
2190
+ export declare const SourceScoreMap: ReadonlyMap<string, number>;
2191
+ export declare const DEFAULT_SOURCE_SCORE = 30;
2192
+ export declare const TypeScoreMap: ReadonlyMap<string, number>;
2193
+ export declare const DEFAULT_TYPE_SCORE = 0;
2194
+ //#endregion
2195
+ //#region src/services/mime/contentType.d.ts
2196
+ export declare const contentType: (value: string) => false | string;
2197
+ //#endregion
2198
+ //#region src/services/mime/extension.d.ts
2199
+ export declare const extension: (type: string) => false | string;
2200
+ //#endregion
2201
+ //#region src/services/mime/getExtensionMimeTypeMap.d.ts
2202
+ export declare const getExtensionMimeTypeMap: () => ReadonlyMap<string, string>;
2203
+ //#endregion
2204
+ //#region src/services/mime/getMediaType.d.ts
2205
+ export declare const getMediaType: (value: string) => string;
2206
+ //#endregion
2207
+ //#region src/services/mime/getMimeScore.d.ts
2208
+ export declare const getMimeScore: (mimeType: string, source?: string) => number;
2209
+ //#endregion
2210
+ //#region src/services/mime/getMimeTypeEntryMap.d.ts
2211
+ export declare const getMimeTypeEntryMap: () => ReadonlyMap<string, MimeDatabaseEntry>;
2212
+ //#endregion
2213
+ //#region src/services/mime/lookup.d.ts
2214
+ export declare const lookup: (path: string) => false | string;
2215
+ //#endregion
2216
+ //#region src/services/prettier/css.d.ts
2217
+ export declare const css: typeof String.raw;
2218
+ //#endregion
2219
+ //#region src/services/prettier/html.d.ts
2220
+ export declare const html: typeof String.raw;
2221
+ //#endregion
2222
+ //#region src/services/profanity/checkContainsProfanity.d.ts
2223
+ export declare const checkContainsProfanity: (text: unknown, { isWholeWord }?: Partial<ProfanityOptions>) => boolean;
2224
+ //#endregion
2225
+ //#region src/services/profanity/englishProfaneWords.d.ts
2226
+ export declare const englishProfaneWords: readonly string[];
2227
+ //#endregion
2228
+ //#region src/services/sanitizeHtml/checkIsAllowedUrl.d.ts
2229
+ export declare const checkIsAllowedUrl: (url: string, allowedSchemes: string[]) => boolean;
2230
+ //#endregion
2231
+ //#region src/services/sanitizeHtml/checkIsUnsafeUrlCharacter.d.ts
2232
+ export declare const checkIsUnsafeUrlCharacter: (character: string) => boolean;
2233
+ //#endregion
2234
+ //#region src/services/sanitizeHtml/checkIsWhitespaceCharacter.d.ts
2235
+ export declare const checkIsWhitespaceCharacter: (character: string) => boolean;
2236
+ //#endregion
2237
+ //#region src/services/sanitizeHtml/collectText.d.ts
2238
+ export declare const collectText: (nodes: DefaultTreeAdapterTypes.ChildNode[], depth: number) => string;
2239
+ //#endregion
2240
+ //#region src/services/sanitizeHtml/constants.d.ts
2241
+ export declare const HTML_NAMESPACE: html$1.NS;
2242
+ export declare const DEFAULT_ALLOWED_TAGS: string[];
2243
+ export declare const DEFAULT_LINK_ATTRIBUTES: string[];
2244
+ export declare const DEFAULT_ALLOWED_ATTRIBUTES: Record<string, string[]>;
2245
+ export declare const DEFAULT_ALLOWED_SCHEMES: string[];
2246
+ export declare const NON_TEXT_TAGS: string[];
2247
+ export declare const VOID_TAGS: string[];
2248
+ export declare const URL_ATTRIBUTES: string[];
2249
+ export declare const SRCSET_ATTRIBUTE = "srcset";
2250
+ export declare const IMPORTANT_REGEX: RegExp;
2251
+ export declare const MAX_NESTING_DEPTH = 256;
2252
+ export declare const SRCSET_DESCRIPTOR_REGEX: RegExp;
2253
+ export declare const ESCAPED_TEXT_CHARACTERS_REGEX: RegExp;
2254
+ export declare const ESCAPED_ATTRIBUTE_CHARACTERS_REGEX: RegExp;
2255
+ export declare const SANITIZER_ADVISORY_WATCH_SINCE = "2026-10-21";
2256
+ //#endregion
2257
+ //#region src/services/sanitizeHtml/escapeAttribute.d.ts
2258
+ export declare const escapeAttribute: (value: string) => string;
2259
+ //#endregion
2260
+ //#region src/services/sanitizeHtml/escapeCharacters.d.ts
2261
+ export declare const escapeCharacters: (value: string, charactersRegex: RegExp, entities: Record<string, string>) => string;
2262
+ //#endregion
2263
+ //#region src/services/sanitizeHtml/escapeText.d.ts
2264
+ export declare const escapeText: (text: string) => string;
2265
+ //#endregion
2266
+ //#region src/services/sanitizeHtml/filterAttributes.d.ts
2267
+ export declare const filterAttributes: (element: DefaultTreeAdapterTypes.Element, policy: SanitizePolicy) => Record<string, string>;
2268
+ //#endregion
2269
+ //#region src/services/sanitizeHtml/filterClasses.d.ts
2270
+ export declare const filterClasses: (value: string, patterns: string[] | undefined) => string | undefined;
2271
+ //#endregion
2272
+ //#region src/services/sanitizeHtml/filterHtml.d.ts
2273
+ export declare const filterHtml: (html: string, policy: SanitizePolicy) => string;
2274
+ //#endregion
2275
+ //#region src/services/sanitizeHtml/filterSrcset.d.ts
2276
+ export declare const filterSrcset: (value: string, allowedSchemes: string[]) => string | undefined;
2277
+ //#endregion
2278
+ //#region src/services/sanitizeHtml/filterStyle.d.ts
2279
+ export declare const filterStyle: (value: string, rules: Record<string, RegExp[]> | undefined) => string | undefined;
2280
+ //#endregion
2281
+ //#region src/services/sanitizeHtml/getChildNodes.d.ts
2282
+ export declare const getChildNodes: (element: DefaultTreeAdapterTypes.Element) => DefaultTreeAdapterTypes.ChildNode[];
2283
+ //#endregion
2284
+ //#region src/services/sanitizeHtml/matchesClassPattern.d.ts
2285
+ export declare const matchesClassPattern: (className: string, pattern: string) => boolean;
2286
+ //#endregion
2287
+ //#region src/services/sanitizeHtml/renderNode.d.ts
2288
+ export declare const renderNode: (node: DefaultTreeAdapterTypes.ChildNode, policy: SanitizePolicy, depth: number) => string;
2289
+ //#endregion
2290
+ //#region src/services/sanitizeHtml/sanitizeHtml.d.ts
2291
+ export declare const sanitizeHtml: (html: string, options?: SanitizeHtmlOptions) => string;
2292
+ //#endregion
2293
+ //#region src/services/sanitizeHtml/sanitizeTextHtml.d.ts
2294
+ export declare const sanitizeTextHtml: (html: string) => string;
2295
+ //#endregion
2296
+ //#region src/services/shared/applyItemMetadataMixin.d.ts
2297
+ export declare const applyItemMetadataMixin: <TBase extends Class<object>>(Base: TBase) => ItemMetadataClass<TBase>;
2298
+ //#endregion
2299
+ //#region src/services/zod/createNormalizedStringSchema.d.ts
2300
+ export declare const createNormalizedStringSchema: (maxLength: number, schema?: z.ZodString) => z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
2301
+ //#endregion
2302
+ //#region src/services/zod/createUniqueArraySchema.d.ts
2303
+ export declare const createUniqueArraySchema: CreateUniqueArraySchema;
2304
+ //#endregion
2305
+ //#region src/services/zstd/constants.d.ts
2306
+ export declare const DEFAULT_COMPRESSION_LEVEL = 12;
2307
+ export declare const MIN_WINDOW_LOG = 10;
2308
+ export declare const MAX_WINDOW_LOG = 27;
2309
+ //#endregion
2310
+ //#region src/services/zstd/getWindowLog.d.ts
2311
+ export declare const getWindowLog: (dictionaryByteCount: number, inputByteCount: number) => number;
2312
+ //#endregion
2313
+ //#region src/test/constants.d.ts
2314
+ export declare const ALL_SPECIAL_VALUES: {
2315
+ isPlainObject: boolean;
2316
+ value: unknown;
2317
+ }[];
2318
+ //#endregion
2319
+ //#region src/util/array/chunk.d.ts
2320
+ export declare const chunk: <T>(array: T[], size: number) => T[][];
2321
+ //#endregion
2322
+ //#region src/util/array/chunkBySerializedSize.d.ts
2323
+ export declare const chunkBySerializedSize: <T>(items: T[], maxBytes: number, maxCount: number) => T[][];
2324
+ //#endregion
2325
+ //#region src/util/array/takeOne.d.ts
2326
+ export declare const takeOne: TakeOne;
2327
+ //#endregion
2328
+ //#region src/util/array/takeRandom.d.ts
2329
+ export declare const takeRandom: <T>(values: readonly T[], random: () => number) => T;
2330
+ //#endregion
2331
+ //#region src/util/date/getEndOfDay.d.ts
2332
+ export declare const getEndOfDay: (date: Date) => Date;
2333
+ //#endregion
2334
+ //#region src/util/date/getZonedDateTime.d.ts
2335
+ export declare const getZonedDateTime: (date: Date) => Temporal.ZonedDateTime;
2336
+ //#endregion
2337
+ //#region src/util/dom/checkIsNestedControl.d.ts
2338
+ export declare const checkIsNestedControl: (event: MouseEvent) => boolean;
2339
+ //#endregion
2340
+ //#region src/util/dom/checkIsNestedInteraction.d.ts
2341
+ export declare const checkIsNestedInteraction: (event: MouseEvent) => boolean;
2342
+ //#endregion
2343
+ //#region src/util/dom/downloadFile.d.ts
2344
+ export declare const downloadFile: (filename: string, blobPart: BlobPart, type: string) => void;
2345
+ //#endregion
2346
+ //#region src/util/dom/downloadUrl.d.ts
2347
+ export declare const downloadUrl: (url: string, filename: string) => void;
2348
+ //#endregion
2349
+ //#region src/util/environment/checkIsServer.d.ts
2350
+ export declare const checkIsServer: () => boolean;
2351
+ //#endregion
2352
+ //#region src/util/function/getSynchronizedFunction.d.ts
2353
+ export declare const getSynchronizedFunction: <TArgs extends unknown[]>(asyncFunction: (...args: TArgs) => Promise<unknown>) => ((...args: TArgs) => void);
2354
+ export declare const waitForSynchronizedFunctions: () => Promise<void>;
2355
+ //#endregion
2356
+ //#region src/util/function/noop.d.ts
2357
+ export declare const noop: () => void;
2358
+ //#endregion
2359
+ //#region src/util/id/constants.d.ts
2360
+ export declare const ID_SEPARATOR = "|";
2361
+ //#endregion
2362
+ //#region src/util/id/uuid/constants.d.ts
2363
+ export declare const UUIDV4_REGEX: RegExp;
2364
+ //#endregion
2365
+ //#region src/util/map/getOrCreate.d.ts
2366
+ export declare const getOrCreate: <TKey, TValue>(map: Map<TKey, TValue>, key: TKey, create: () => TValue) => TValue;
2367
+ //#endregion
2368
+ //#region src/util/object/checkIsCustomMethod.d.ts
2369
+ export declare const checkIsCustomMethod: (value: object, methodName: ObjectMethod) => boolean;
2370
+ //#endregion
2371
+ //#region src/util/object/checkIsDeepEqual.d.ts
2372
+ export declare const checkIsDeepEqual: (first: unknown, second: unknown) => boolean;
2373
+ //#endregion
2374
+ //#region src/util/object/checkIsPlainObject.d.ts
2375
+ export declare const checkIsPlainObject: (data: unknown) => data is Record<string, unknown>;
2376
+ //#endregion
2377
+ //#region src/util/object/checkIsSameBytes.d.ts
2378
+ export declare const checkIsSameBytes: (first: ArrayBuffer | ArrayBufferView | SharedArrayBuffer, second: ArrayBuffer | ArrayBufferView | SharedArrayBuffer) => boolean;
2379
+ //#endregion
2380
+ //#region src/util/object/checkIsSameValueZero.d.ts
2381
+ export declare const checkIsSameValueZero: (first: unknown, second: unknown) => boolean;
2382
+ //#endregion
2383
+ //#region src/util/object/clonePlainDeep.d.ts
2384
+ export declare const clonePlainDeep: <T>(data: T) => T;
2385
+ //#endregion
2386
+ //#region src/util/object/getEnumerableKeys.d.ts
2387
+ export declare const getEnumerableKeys: (value: object) => PropertyKey[];
2388
+ //#endregion
2389
+ //#region src/util/types/GetArrayProps.d.ts
2390
+ export type GetArrayProps<T extends unknown[], P extends string, D extends unknown[], R extends boolean> = (D extends [unknown, ...infer Rest] ? GetProperties<T[number], R extends true ? `${P}[number]` : `${P}.[number]`, Rest, false> : never) | {
2391
+ path: R extends true ? "length" : `${P}.length`;
2392
+ value: T["length"];
2393
+ };
2394
+ //#endregion
2395
+ //#region src/util/types/KnownKeys.d.ts
2396
+ export type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
2397
+ //#endregion
2398
+ //#region src/util/types/GetObjectProps.d.ts
2399
+ export type GetObjectProps<T, P extends string, D extends unknown[], R extends boolean> = { [K in keyof KnownKeys<T> & (number | string)]: K extends `${number}` ? never : NonNullable<T[K]> extends FunctionLike ? never : (D extends [unknown, ...infer Rest] ? GetProperties<T[K], R extends true ? `${K}` : `${P}.${K}`, Rest, false> : never) | {
2400
+ path: R extends true ? `${K}` : `${P}.${K}`;
2401
+ value: T[K];
2402
+ }; }[keyof KnownKeys<T> & (number | string)];
2403
+ //#endregion
2404
+ //#region src/util/types/GetPrimitiveProps.d.ts
2405
+ export type GetPrimitiveProps<T, P extends string, D extends unknown[], R extends boolean> = T extends string ? {
2406
+ path: R extends true ? "length" : `${P}.length`;
2407
+ value: number;
2408
+ } : T extends symbol ? (D extends [unknown, ...infer Rest] ? GetProperties<string | undefined, R extends true ? "description" : `${P}.description`, Rest, false> : never) | {
2409
+ path: R extends true ? "description" : `${P}.description`;
2410
+ value: string | undefined;
2411
+ } : never;
2412
+ //#endregion
2413
+ //#region src/util/types/GetProperties.d.ts
2414
+ export type GetProperties<T, P extends string = "", D extends unknown[] = [unknown, unknown, unknown, unknown, unknown], R extends boolean = true> = [T] extends [never] ? never : D extends [] ? never : NonNullable<T> extends (infer O) ? O extends unknown[] ? GetArrayProps<O, P, D, R> : O extends object ? GetObjectProps<O, P, D, R> : GetPrimitiveProps<O, P, D, R> : never;
2415
+ //#endregion
2416
+ //#region src/util/types/GetPaths.d.ts
2417
+ export type GetPaths<T> = GetProperties<T> extends (infer U) ? (U extends {
2418
+ path: infer Path;
2419
+ } ? Path : never) : never;
2420
+ //#endregion
2421
+ //#region src/util/types/PropertyNames.d.ts
2422
+ export type PropertyNames<T> = { [P in GetPaths<T>]: P; };
2423
+ //#endregion
2424
+ //#region src/util/object/getPropertyNames.d.ts
2425
+ export declare const getPropertyNames: <T>() => PropertyNames<T>;
2426
+ //#endregion
2427
+ //#region src/util/object/jsonDateParse.d.ts
2428
+ export declare const jsonDateParse: <T = any>(text: string) => T;
2429
+ //#endregion
2430
+ //#region src/util/types/MergeObjectsStrict.d.ts
2431
+ export type MergeObjectsStrict<T extends object[]> = T extends [infer TFirst, infer TSecond, ...infer TRemaining] ? TSecond extends { [K in keyof TSecond]: K extends keyof TFirst ? never : TSecond[K]; } ? TRemaining extends object[] ? MergeObjectsStrict<[TSecond, ...TRemaining]> & TFirst : TFirst & TSecond : never : T extends [infer TFirst] ? TFirst : never;
2432
+ //#endregion
2433
+ //#region src/util/object/mergeObjectsStrict.d.ts
2434
+ export declare const mergeObjectsStrict: <T extends object[]>(...objects: T) => MergeObjectsStrict<T>;
2435
+ //#endregion
2436
+ //#region src/util/object/omitDeep.d.ts
2437
+ export declare const omitDeep: <T, TKey extends string>(value: T, ...keys: TKey[]) => DeepOmit<T, TKey>;
2438
+ //#endregion
2439
+ //#region src/util/promise/createEvictingPromiseCache.d.ts
2440
+ export declare const createEvictingPromiseCache: <TArguments extends unknown[], TValue>(getKey: (...args: TArguments) => string, load: (...args: TArguments) => Promise<TValue>) => ((...args: TArguments) => Promise<TValue>);
2441
+ //#endregion
2442
+ //#region src/util/promise/settleAll.d.ts
2443
+ export declare const settleAll: <T>(tasks: (() => Promise<T>)[], concurrencyLimit?: number) => Promise<T[]>;
2444
+ //#endregion
2445
+ //#region src/util/reactivity/getRawData.d.ts
2446
+ export declare const getRawData: <T>(data: T) => T;
2447
+ //#endregion
2448
+ //#region src/util/reactivity/toRawDeep.d.ts
2449
+ export declare const toRawDeep: <T extends object>(data: T) => T;
2450
+ //#endregion
2451
+ //#region src/util/text/capitalize.d.ts
2452
+ export declare const capitalize: (string: string) => string;
2453
+ //#endregion
2454
+ //#region src/util/text/dedent.d.ts
2455
+ export declare const dedent: Dedent;
2456
+ //#endregion
2457
+ //#region src/util/text/encodeUrlSubDelimiters.d.ts
2458
+ export declare const encodeUrlSubDelimiters: (value: string) => string;
2459
+ //#endregion
2460
+ //#region src/util/text/getDecodedUriComponent.d.ts
2461
+ export declare const getDecodedUriComponent: (value: string, fallback: string) => string;
2462
+ //#endregion
2463
+ //#region src/util/text/normalizeString.d.ts
2464
+ export declare const normalizeString: (value: string | undefined) => string;
2465
+ //#endregion
2466
+ //#region src/util/text/streamToText.d.ts
2467
+ export declare const streamToText: (readable: NodeJS.ReadableStream) => Promise<string>;
2468
+ //#endregion
2469
+ //#region src/util/text/toKebabCase.d.ts
2470
+ export declare const toKebabCase: <T extends string>(string: T) => KebabCase<T>;
2471
+ //#endregion
2472
+ //#region src/util/text/truncate.d.ts
2473
+ export declare const truncate: (string: string, length: number) => string;
2474
+ //#endregion
2475
+ //#region src/util/text/uncapitalize.d.ts
2476
+ export declare const uncapitalize: <T extends string>(string: T) => Uncapitalize<T>;
2477
+ //#endregion
2478
+ //#region src/util/time/constants.d.ts
2479
+ export declare const MILLISECONDS_PER_SECOND = 1e3;
2480
+ //#endregion
2481
+ //#region src/util/time/hrtime.d.ts
2482
+ export declare const hrtime: (previousHrTime?: [number, number]) => [number, number];
2483
+ //#endregion
2484
+ //#region src/util/time/now.d.ts
2485
+ export declare const now: () => string;
2486
+ //#endregion
2487
+ //#region src/util/time/sleep.d.ts
2488
+ export declare const sleep: (durationMs: number) => Promise<void>;
2489
+ //#endregion
2490
+ //#region src/util/validation/exhaustiveGuard.d.ts
2491
+ export declare const exhaustiveGuard: (value: never) => never;
2492
+ //#endregion
2493
+ export {};