From 88baaebcf5ad80938f6529f6bfada1f64a4209ee Mon Sep 17 00:00:00 2001 From: Infendro Date: Fri, 8 May 2026 15:15:44 +0200 Subject: [PATCH] Refactor --- src/collection.ts | 2 +- src/collection/toObject.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/collection.ts b/src/collection.ts index 4156fe3..a182381 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -83,7 +83,7 @@ import {Key, Object, toObject} from "./collection/toObject"; export type Collection = { [Symbol.iterator](): Iterator - toObject(this: Collection<[K, V]>): Object + toObject(this: Collection<[K, V]>): Object toArray(): T[] toSet(): Set toMap(this: Collection<[K, V]>): Map diff --git a/src/collection/toObject.ts b/src/collection/toObject.ts index c2b9304..e113fa3 100644 --- a/src/collection/toObject.ts +++ b/src/collection/toObject.ts @@ -1,6 +1,6 @@ export type Key = keyof any -export type Object = { [key in K]: V } +export type Object = { [key in K]?: V } -export function toObject(value: [K, V][]): Object { - return Object.fromEntries(value) as Object; +export function toObject(value: [K, V][]): Object { + return Object.fromEntries(value) as Object; }