40 lines
1 KiB
Text
40 lines
1 KiB
Text
=== tests/cases/compiler/argumentsObjectIterator02_ES6.ts ===
|
|
|
|
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
|
|
>doubleAndReturnAsArray : (x: number, y: number, z: number) => [number, number, number]
|
|
>x : number
|
|
>y : number
|
|
>z : number
|
|
|
|
let blah = arguments[Symbol.iterator];
|
|
>blah : () => IterableIterator<any>
|
|
>arguments[Symbol.iterator] : () => IterableIterator<any>
|
|
>arguments : IArguments
|
|
>Symbol.iterator : symbol
|
|
>Symbol : SymbolConstructor
|
|
>iterator : symbol
|
|
|
|
let result = [];
|
|
>result : any[]
|
|
>[] : undefined[]
|
|
|
|
for (let arg of blah()) {
|
|
>arg : any
|
|
>blah() : IterableIterator<any>
|
|
>blah : () => IterableIterator<any>
|
|
|
|
result.push(arg + arg);
|
|
>result.push(arg + arg) : number
|
|
>result.push : (...items: any[]) => number
|
|
>result : any[]
|
|
>push : (...items: any[]) => number
|
|
>arg + arg : any
|
|
>arg : any
|
|
>arg : any
|
|
}
|
|
return <[any, any, any]>result;
|
|
><[any, any, any]>result : [any, any, any]
|
|
>result : any[]
|
|
}
|
|
|
|
|