feat: entriesWithType

This commit is contained in:
2024-03-09 07:39:48 +00:00
parent c7c84b4fd3
commit 9aecd4dfb4
3 changed files with 6 additions and 7 deletions
+1 -3
View File
@@ -1,6 +1,4 @@
type Entries<T> = {
[K in keyof T]: [K, T[K]];
}[keyof T][];
import type { Entries } from "../types.js";
export function entriesWithType<T extends object>(value: T): Entries<T>{
return Object.entries(value) as unknown as Entries<T>;
+2 -1
View File
@@ -2,4 +2,5 @@ export * from "./combineObject.js";
export * from "./combineArray.js";
export * from "./convertBytesLikeToUint8Array.js";
export * from "./convertIDArray.js";
export * from "./convertIterableToMap.js"
export * from "./convertIterableToMap.js"
export * from "./entriesWithType.js";
+3 -3
View File
@@ -3,12 +3,12 @@ export type Nullable<T> = T | null | undefined;
export declare type ValuesOf<T> = T[keyof T];
export type IDItem<T> = {
id: T;
id: T;
};
export type Entries<T> = {
[K in keyof T]: [K, T[K]];
}[keyof T][];
[K in keyof T]: [K, T[K]];
}[keyof T][];
export type BufferSource = ArrayBufferView | ArrayBuffer | SharedArrayBuffer;