20
20
21
21
/// <reference types="@stdlib/types"/>
22
22
23
- import { ArrayLike } from '@stdlib/types/array' ;
24
23
import { typedndarray } from '@stdlib/types/ndarray' ;
25
24
26
25
/**
27
26
* Callback invoked for each ndarray element.
28
27
*
29
28
* @returns output value
30
29
*/
31
- type Nullary < U , ThisArg > = ( this : ThisArg ) => U ;
30
+ type Nullary < V , ThisArg > = ( this : ThisArg ) => V ;
32
31
33
32
/**
34
33
* Callback invoked for each ndarray element.
35
34
*
36
35
* @param value - current array element
37
36
* @returns output value
38
37
*/
39
- type Unary < T , U , ThisArg > = ( this : ThisArg , value : T ) => U ;
38
+ type Unary < T , V , ThisArg > = ( this : ThisArg , value : T ) => V ;
40
39
41
40
/**
42
41
* Callback invoked for each ndarray element.
@@ -45,7 +44,7 @@ type Unary<T, U, ThisArg> = ( this: ThisArg, value: T ) => U;
45
44
* @param indices - current array element indices
46
45
* @returns output value
47
46
*/
48
- type Binary < T , U , ThisArg > = ( this : ThisArg , value : T , indices : Array < number > ) => U ;
47
+ type Binary < T , V , ThisArg > = ( this : ThisArg , value : T , indices : Array < number > ) => V ;
49
48
50
49
/**
51
50
* Callback invoked for each ndarray element.
@@ -55,7 +54,7 @@ type Binary<T, U, ThisArg> = ( this: ThisArg, value: T, indices: Array<number> )
55
54
* @param arr - input array
56
55
* @returns output value
57
56
*/
58
- type Ternary < T , U , ThisArg > = ( this : ThisArg , value : T , indices : Array < number > , arr : typedndarray < T > ) => U ;
57
+ type Ternary < T , U , V , ThisArg > = ( this : ThisArg , value : T , indices : Array < number > , arr : U ) => V ;
59
58
60
59
/**
61
60
* Callback invoked for each ndarray element.
@@ -65,7 +64,7 @@ type Ternary<T, U, ThisArg> = ( this: ThisArg, value: T, indices: Array<number>,
65
64
* @param arr - input array
66
65
* @returns output value
67
66
*/
68
- type Callback < T , U , ThisArg > = Nullary < U , ThisArg > | Unary < T , U , ThisArg > | Binary < T , U , ThisArg > | Ternary < T , U , ThisArg > ;
67
+ type Callback < T , U , V , ThisArg > = Nullary < V , ThisArg > | Unary < T , V , ThisArg > | Binary < T , V , ThisArg > | Ternary < T , U , V , ThisArg > ;
69
68
70
69
/**
71
70
* Applies a callback function to elements in an input ndarray and assigns results to elements in an output ndarray.
@@ -109,7 +108,7 @@ type Callback<T, U, ThisArg> = Nullary<U, ThisArg> | Unary<T, U, ThisArg> | Bina
109
108
* console.log( y.data );
110
109
* // => <Float64Array>[ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]
111
110
*/
112
- declare function map < T = unknown , U = unknown , ThisArg = unknown > ( arrays : ArrayLike < typedndarray < T > > , fcn : Callback < T , U , ThisArg > , thisArg ?: ThisParameterType < Callback < T , U , ThisArg > > ) : void ;
111
+ declare function map < T = unknown , U extends typedndarray < T > = typedndarray < T > , V = unknown , ThisArg = unknown > ( arrays : [ U , typedndarray < V > ] , fcn : Callback < T , U , V , ThisArg > , thisArg ?: ThisParameterType < Callback < T , U , V , ThisArg > > ) : void ;
113
112
114
113
115
114
// EXPORTS //
0 commit comments