Navigation Menu

Skip to content

Commit

Permalink
Don't use any[] in arrayFrom (#31201)
Browse files Browse the repository at this point in the history
Don't use `any[]` in `arrayFrom`
  • Loading branch information
DanielRosenwasser committed May 3, 2019
2 parents 66d4010 + b5ffc26 commit fc88a1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compiler/core.ts
Expand Up @@ -1400,8 +1400,8 @@ namespace ts {
/** Shims `Array.from`. */
export function arrayFrom<T, U>(iterator: Iterator<T> | IterableIterator<T>, map: (t: T) => U): U[];
export function arrayFrom<T>(iterator: Iterator<T> | IterableIterator<T>): T[];
export function arrayFrom(iterator: Iterator<any> | IterableIterator<any>, map?: (t: any) => any): any[] {
const result: any[] = [];
export function arrayFrom<T, U>(iterator: Iterator<T> | IterableIterator<T>, map?: (t: T) => U): (T | U)[] {
const result: (T | U)[] = [];
for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) {
result.push(map ? map(value) : value);
}
Expand Down

0 comments on commit fc88a1c

Please sign in to comment.