Skip to content

Commit

Permalink
fix(collection): coerce void to undefined in return expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Renegade334 committed May 23, 2024
1 parent ed50e61 commit 02c7468
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/collection/src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
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();
Expand All @@ -100,7 +100,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
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();
Expand Down

0 comments on commit 02c7468

Please sign in to comment.