diff --git a/packages/collection/src/collection.ts b/packages/collection/src/collection.ts index 574e22a27f9e..3d7228a959c1 100644 --- a/packages/collection/src/collection.ts +++ b/packages/collection/src/collection.ts @@ -83,7 +83,7 @@ export class Collection extends Map { public first(): Value | undefined; public first(amount: number): Value[]; public first(amount?: number): Value | Value[] | undefined { - if (amount === undefined) return this.values().next().value; + if (amount === undefined) return this.values().next().value as Value | undefined; if (amount < 0) return this.last(amount * -1); amount = Math.min(this.size, amount); const iter = this.values(); @@ -100,7 +100,7 @@ export class Collection extends Map { public firstKey(): Key | undefined; public firstKey(amount: number): Key[]; public firstKey(amount?: number): Key | Key[] | undefined { - if (amount === undefined) return this.keys().next().value; + if (amount === undefined) return this.keys().next().value as Key | undefined; if (amount < 0) return this.lastKey(amount * -1); amount = Math.min(this.size, amount); const iter = this.keys();