1616* limitations under the License.
1717*/
1818
19- // TypeScript Version: 2.0
19+ // TypeScript Version: 4.1
2020
2121/// <reference types="@stdlib/types"/>
2222
23- import { Iterator as Iter , IterableIterator } from '@stdlib/types/iter' ;
24- import { ArrayLike } from '@stdlib/types/array' ;
23+ import { TypedIterator , TypedIterableIterator } from '@stdlib/types/iter' ;
2524import { Collection } from '@stdlib/types/object' ;
2625
2726// Define a union type representing both iterable and non-iterable iterators:
28- type Iterator = Iter | IterableIterator ;
27+ type Iterator < T > = TypedIterator < T > | TypedIterableIterator < T > ;
2928
3029/**
3130* Map function invoked for each iterated value.
3231*
3332* @returns iterator value
3433*/
35- type Nullary = ( ) => any ;
34+ type Nullary < U > = ( ) => U ;
3635
3736/**
3837* Map function invoked for each iterated value.
3938*
4039* @param value - iterated value
4140* @returns iterator value
4241*/
43- type Unary = ( value : any ) => any ;
42+ type Unary < T , U > = ( value : T ) => U ;
4443
4544/**
4645* Map function invoked for each iterated value.
@@ -49,7 +48,7 @@ type Unary = ( value: any ) => any;
4948* @param index - iterated value index
5049* @returns iterator value
5150*/
52- type Binary = ( value : any , index : number ) => any ;
51+ type Binary < T , U > = ( value : T , index : number ) => U ;
5352
5453/**
5554* Map function invoked for each iterated value.
@@ -59,7 +58,7 @@ type Binary = ( value: any, index: number ) => any;
5958* @param src - source array-like object
6059* @returns iterator value
6160*/
62- type Ternary = ( value : any , index : number , src : ArrayLike < any > ) => any ;
61+ type Ternary < T , U > = ( value : T , index : number , src : Collection < U > ) => U ;
6362
6463/**
6564* Map function invoked for each iterated value.
@@ -69,7 +68,7 @@ type Ternary = ( value: any, index: number, src: ArrayLike<any> ) => any;
6968* @param src - source array-like object
7069* @returns iterator value
7170*/
72- type MapFunction = Nullary | Unary | Binary | Ternary ;
71+ type MapFunction < T , U > = Nullary < U > | Unary < T , U > | Binary < T , U > | Ternary < T , U > ;
7372
7473/**
7574* Fills an array-like object view from right to left with values returned from an iterator.
@@ -92,7 +91,7 @@ type MapFunction = Nullary | Unary | Binary | Ternary;
9291* var arr = iterator2arrayviewRight( iter, new Float64Array( 20 ) );
9392* // returns <Float64Array>
9493*/
95- declare function iterator2arrayviewRight ( iterator : Iterator , out : Collection , mapFcn ?: MapFunction , thisArg ?: any ) : Collection ; // tslint:disable-line:max-line-length
94+ declare function iterator2arrayviewRight < T = any , U = T > ( iterator : Iterator < T > , out : Collection < U > , mapFcn ?: MapFunction < T , U > , thisArg ?: any ) : Collection < U > ;
9695
9796/**
9897* Fills an array-like object view from right to left with values returned from an iterator.
@@ -116,7 +115,7 @@ declare function iterator2arrayviewRight( iterator: Iterator, out: Collection, m
116115* var arr = iterator2arrayviewRight( iter, new Float64Array( 20 ), 5 );
117116* // returns <Float64Array>
118117*/
119- declare function iterator2arrayviewRight ( iterator : Iterator , out : Collection , begin : number , mapFcn ?: MapFunction , thisArg ?: any ) : Collection ; // tslint:disable-line:max-line-length
118+ declare function iterator2arrayviewRight < T = any , U = T > ( iterator : Iterator < T > , out : Collection < U > , begin : number , mapFcn ?: MapFunction < T , U > , thisArg ?: any ) : Collection < U > ;
120119
121120/**
122121* Fills an array-like object view from right to left with values returned from an iterator.
@@ -142,7 +141,7 @@ declare function iterator2arrayviewRight( iterator: Iterator, out: Collection, b
142141* var arr = iterator2arrayviewRight( iter, new Float64Array( 20 ), 5, 8 );
143142* // returns <Float64Array>
144143*/
145- declare function iterator2arrayviewRight ( iterator : Iterator , out : Collection , begin : number , end : number , mapFcn ?: MapFunction , thisArg ?: any ) : Collection ; // tslint:disable-line:max-line-length
144+ declare function iterator2arrayviewRight < T = any , U = T > ( iterator : Iterator < T > , out : Collection < U > , begin : number , end : number , mapFcn ?: MapFunction < T , U > , thisArg ?: any ) : Collection < U > ;
146145
147146
148147// EXPORTS //
0 commit comments