// eslint-disable-next-line @typescript-eslint/no-explicit-any export type PartialRecord = { [P in K]?: T; } export function* itemAndIndex(arr: T[]): Iterable<[T, number]> { for (let i = 0; i < arr.length; i++) { yield [arr[i], i] as [T, number]; } } export function* reversed(arr: T[]): Iterable { for (let i = arr.length - 1; i >= 0; i--) { yield arr[i] as T; } } export function* reversedItemAndIndex(arr: T[]): Iterable<[T, number]> { for (let i = arr.length - 1; i >= 0; i--) { yield [arr[i], i] as [T, number]; } } export function* entries(obj: Record): Iterable<[K, V]> { for (const key in obj) { if (!Object.prototype.hasOwnProperty.call(obj, key)) { continue; } yield [key, obj[key]] as [K, V]; } } export function* keys(obj: Record): Iterable { for (const key in obj) { if (!Object.prototype.hasOwnProperty.call(obj, key)) { continue; } yield key as K; } } export function* keysIfValueEquals(obj: Record, value: V): Iterable { for (const key in obj) { if (!Object.prototype.hasOwnProperty.call(obj, key)) { continue; } if (obj[key] !== value) { continue; } yield key as K; } } export function* values(obj: Record): Iterable { for (const key in obj) { if (!Object.prototype.hasOwnProperty.call(obj, key)) { continue; } yield obj[key] as V; } } export interface NameValue { readonly name: string; readonly value: string; } export interface NameNumeralValue { readonly name: string; readonly value: number; } export interface TypeAndName { readonly type: number; readonly name: string; } export interface TypeAndDisplayName { readonly type: number; readonly displayName: string; } export interface LocalizedSwitchOption { readonly value: boolean; readonly displayName: string; } export type BeforeResolveFunction = (callback: () => void) => void;