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> = { import type { Entries } from "../types.js";
[K in keyof T]: [K, T[K]];
}[keyof T][];
export function entriesWithType<T extends object>(value: T): Entries<T>{ export function entriesWithType<T extends object>(value: T): Entries<T>{
return Object.entries(value) as unknown as Entries<T>; return Object.entries(value) as unknown as Entries<T>;
+1
View File
@@ -3,3 +3,4 @@ export * from "./combineArray.js";
export * from "./convertBytesLikeToUint8Array.js"; export * from "./convertBytesLikeToUint8Array.js";
export * from "./convertIDArray.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 declare type ValuesOf<T> = T[keyof T];
export type IDItem<T> = { export type IDItem<T> = {
id: T; id: T;
}; };
export type Entries<T> = { export type Entries<T> = {
[K in keyof T]: [K, T[K]]; [K in keyof T]: [K, T[K]];
}[keyof T][]; }[keyof T][];
export type BufferSource = ArrayBufferView | ArrayBuffer | SharedArrayBuffer; export type BufferSource = ArrayBufferView | ArrayBuffer | SharedArrayBuffer;