Skip to content

Commit bf83db9

Browse files
rbucktonckohenRenegade334almeidx
authored
fix(build): update to support strictBuiltinIteratorReturn (#10394)
* fix(build): update to support strictBuiltinIteratorReturn * types: assert Value to be identical to InitialValue Co-authored-by: René <[email protected]> --------- Co-authored-by: ckohen <[email protected]> Co-authored-by: René <[email protected]> Co-authored-by: Almeida <[email protected]>
1 parent 1b1ae2f commit bf83db9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/collection/src/collection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
8787
if (amount < 0) return this.last(amount * -1);
8888
amount = Math.min(this.size, amount);
8989
const iter = this.values();
90-
return Array.from({ length: amount }, (): Value => iter.next().value);
90+
return Array.from({ length: amount }, (): Value => iter.next().value!);
9191
}
9292

9393
/**
@@ -104,7 +104,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
104104
if (amount < 0) return this.lastKey(amount * -1);
105105
amount = Math.min(this.size, amount);
106106
const iter = this.keys();
107-
return Array.from({ length: amount }, (): Key => iter.next().value);
107+
return Array.from({ length: amount }, (): Key => iter.next().value!);
108108
}
109109

110110
/**
@@ -512,7 +512,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
512512
if (thisArg !== undefined) fn = fn.bind(thisArg);
513513
const iter = this.entries();
514514
return Array.from({ length: this.size }, (): NewValue => {
515-
const [key, value] = iter.next().value;
515+
const [key, value] = iter.next().value!;
516516
return fn(value, key, this);
517517
});
518518
}
@@ -634,7 +634,7 @@ export class Collection<Key, Value> extends Map<Key, Value> {
634634
const iterator = this.entries();
635635
if (initialValue === undefined) {
636636
if (this.size === 0) throw new TypeError('Reduce of empty collection with no initial value');
637-
accumulator = iterator.next().value[1];
637+
accumulator = iterator.next().value![1] as unknown as InitialValue;
638638
} else {
639639
accumulator = initialValue;
640640
}

0 commit comments

Comments
 (0)