Skip to content

Commit 83d05b2

Browse files
Don't use 'any[]' - return type are bivariant when relating to overloads.
1 parent b010010 commit 83d05b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,8 +1400,8 @@ namespace ts {
14001400
/** Shims `Array.from`. */
14011401
export function arrayFrom<T, U>(iterator: Iterator<T> | IterableIterator<T>, map: (t: T) => U): U[];
14021402
export function arrayFrom<T>(iterator: Iterator<T> | IterableIterator<T>): T[];
1403-
export function arrayFrom(iterator: Iterator<any> | IterableIterator<any>, map?: (t: any) => any): any[] {
1404-
const result: any[] = [];
1403+
export function arrayFrom<T, U>(iterator: Iterator<T> | IterableIterator<T>, map?: (t: T) => U): Array<T | U> {
1404+
const result: Array<T | U> = [];
14051405
for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) {
14061406
result.push(map ? map(value) : value);
14071407
}

0 commit comments

Comments
 (0)