// String prototype extensions interface String { splice(start: number, len: number, fill?: string): string htmlspecialchars(sign?: 'ENT_QUOTES' | 'ENT_NOQUOTES'): string tohtml(): string xss(): string escape(): string at(num: number): string toJson(): Record lt(v: string): boolean lte(v: string): boolean gt(v: string): boolean gte(v: string): boolean eq(v: string): boolean } // Set prototype extensions interface Set { union(other: Set): Set difference(other: Set): Set symmetricDifference(other: Set): Set intersection(other: Set): Set isSubsetOf(other: Set): boolean isSupersetOf(other: Set): boolean isDisjointFrom(other: Set): boolean equals(other: Set): boolean } // Promise extensions interface PromiseConstructor { defer(): { promise: Promise resolve: (value: T | PromiseLike) => void reject: (reason?: any) => void } withResolvers(): { promise: Promise resolve: (value: T | PromiseLike) => void reject: (reason?: any) => void } } // Object extensions interface ObjectConstructor { empty(obj: any): boolean groupBy(arr: T[], fn: (item: T) => string): Record hasOwn(obj: any, key: string): boolean } interface Object { toParams(): string } // Number extensions interface NumberConstructor { parse(val: string | number): string | number fromString(val: string): number } // Map extensions interface MapConstructor { groupBy(arr: T[], fn: (item: T) => K): Map } // Date prototype extensions interface Date { getFullWeek(): number getWeek(): number format(str?: string): string } // Array prototype extensions interface Array { flat(deep?: number, arr?: T[]): T[] flatMap(callback: (value: T, index: number, array: T[]) => U | U[]): U[] at(num: number): T findLast( predicate: (value: T, index: number, obj: T[]) => boolean ): T | undefined findLastIndex( predicate: (value: T, index: number, obj: T[]) => boolean ): number toSorted(compareFn?: (a: T, b: T) => number): T[] toReversed(): T[] toSpliced(start: number, deleteCount?: number, ...items: T[]): T[] with(index: number, value: T): T[] group(callback: (value: T) => string): Record groupToMap(callback: (value: T) => K): Map }