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; }