Release 202506020353

This commit is contained in:
pluja
2025-06-02 03:53:03 +00:00
parent d065910ff3
commit 6a6908518d
32 changed files with 1507 additions and 230 deletions

View File

@@ -162,3 +162,16 @@ export function areEqualObjectsWithoutOrder<T extends Record<string, unknown>>(
return undefined
})
}
/**
* Same as {@link Object.entries}, but with proper typing.
* @example
* typedObjectEntries({ a: 1, b: 2 }) // [['a', 1], ['b', 2]]
*/
export function typedObjectEntries<T extends Record<string, unknown>>(obj: T) {
return Object.entries(obj) as Prettify<
{
[K in Extract<keyof T, string>]: [K, T[K]]
}[Extract<keyof T, string>]
>[]
}