Skip to content

Commit 0ec1cf6

Browse files
committed
Auto-generated commit
1 parent 8673ec5 commit 0ec1cf6

File tree

20 files changed

+55
-139
lines changed

20 files changed

+55
-139
lines changed

base/flatten-by/docs/types/index.d.ts

+1-53
Original file line numberDiff line numberDiff line change
@@ -22,59 +22,7 @@
2222

2323
/// <reference types="@stdlib/types"/>
2424

25-
import { Collection } from '@stdlib/types/array';
26-
27-
// FIXME: shapes should be collections of a defined length
28-
29-
/**
30-
* One-dimensional array.
31-
*/
32-
type Array1D<T> = Collection<T>;
33-
34-
/**
35-
* Two-dimensional array.
36-
*/
37-
type Array2D<T> = Array<Array1D<T>>;
38-
39-
/**
40-
* Three-dimensional array.
41-
*/
42-
type Array3D<T> = Array<Array2D<T>>;
43-
44-
/**
45-
* Four-dimensional array.
46-
*/
47-
type Array4D<T> = Array<Array3D<T>>;
48-
49-
/**
50-
* Five-dimensional array.
51-
*/
52-
type Array5D<T> = Array<Array4D<T>>;
53-
54-
/**
55-
* Six-dimensional array.
56-
*/
57-
type Array6D<T> = Array<Array5D<T>>;
58-
59-
/**
60-
* Seven-dimensional array.
61-
*/
62-
type Array7D<T> = Array<Array6D<T>>;
63-
64-
/**
65-
* Eight-dimensional array.
66-
*/
67-
type Array8D<T> = Array<Array7D<T>>;
68-
69-
/**
70-
* Nine-dimensional array.
71-
*/
72-
type Array9D<T> = Array<Array8D<T>>;
73-
74-
/**
75-
* Ten-dimensional array.
76-
*/
77-
type Array10D<T> = Array<Array9D<T>>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes
25+
import { Collection, Array1D, Array2D, Array3D, Array4D, Array5D, Array6D, Array7D, Array8D, Array9D, Array10D } from '@stdlib/types/array';
7826

7927
/**
8028
* One-dimensional array shape.

base/flatten2d-by/docs/types/index.d.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
24-
25-
/**
26-
* Two-dimensional nested array.
27-
*/
28-
type Array2D<T> = Array<Collection<T>>;
23+
import { Collection, Array2D } from '@stdlib/types/array';
24+
import { Shape2D } from '@stdlib/types/ndarray';
2925

3026
/**
3127
* Nullary callback function.
@@ -109,7 +105,7 @@ interface Flatten2dBy {
109105
* var out = flatten2dBy( x, [ 2, 2 ], true, scale );
110106
* // returns [ 2, 6, 4, 8 ]
111107
*/
112-
<T = unknown, U = unknown, V = unknown>( x: Array2D<T>, shape: Collection<number>, colexicographic: boolean, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Array<U>;
108+
<T = unknown, U = unknown, V = unknown>( x: Array2D<T>, shape: Shape2D, colexicographic: boolean, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Array<U>;
113109

114110

115111
/**
@@ -153,7 +149,7 @@ interface Flatten2dBy {
153149
* var out = flatten2dBy( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
154150
* // returns <Float64Array>[ 2, 6, 4, 8 ]
155151
*/
156-
assign<T = unknown, U = unknown, V = unknown, W = unknown>( x: Array2D<T>, shape: Collection<number>, colexicographic: boolean, out: Collection<V>, stride: number, offset: number, clbk: Callback<T, U, W>, thisArg?: ThisParameterType<Callback<T, U, W>> ): Collection<U | V>;
152+
assign<T = unknown, U = unknown, V = unknown, W = unknown>( x: Array2D<T>, shape: Shape2D, colexicographic: boolean, out: Collection<V>, stride: number, offset: number, clbk: Callback<T, U, W>, thisArg?: ThisParameterType<Callback<T, U, W>> ): Collection<U | V>;
157153
}
158154

159155
/**

base/flatten2d/docs/types/index.d.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
24-
25-
/**
26-
* Two-dimensional nested array.
27-
*/
28-
type Array2D<T> = Array<Collection<T>>;
23+
import { Collection, Array2D } from '@stdlib/types/array';
24+
import { Shape2D } from '@stdlib/types/ndarray';
2925

3026
/**
3127
* Interface describing `flatten2d`.
@@ -55,7 +51,7 @@ interface Flatten2d {
5551
* var out = flatten2d( x, [ 2, 2 ], true );
5652
* // returns [ 1, 3, 2, 4 ]
5753
*/
58-
<T = unknown>( x: Array2D<T>, shape: Collection<number>, colexicographic: boolean ): Array<T>;
54+
<T = unknown>( x: Array2D<T>, shape: Shape2D, colexicographic: boolean ): Array<T>;
5955

6056
/**
6157
* Flattens a two-dimensional nested array and assigns elements to a provided output array.
@@ -88,7 +84,7 @@ interface Flatten2d {
8884
* var out = flatten2d.assign( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0 );
8985
* // returns <Float64Array>[ 1, 3, 2, 4 ]
9086
*/
91-
assign<T = unknown, U = unknown>( x: Array2D<T>, shape: Collection<number>, colexicographic: boolean, out: Collection<U>, stride: number, offset: number ): Collection<T | U>;
87+
assign<T = unknown, U = unknown>( x: Array2D<T>, shape: Shape2D, colexicographic: boolean, out: Collection<U>, stride: number, offset: number ): Collection<T | U>;
9288
}
9389

9490
/**

base/flatten3d-by/docs/types/index.d.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
24-
25-
/**
26-
* Three-dimensional nested array.
27-
*/
28-
type Array3D<T> = Array<Array<Collection<T>>>;
23+
import { Collection, Array3D } from '@stdlib/types/array';
24+
import { Shape3D } from '@stdlib/types/ndarray';
2925

3026
/**
3127
* Nullary callback function.
@@ -109,7 +105,7 @@ interface Flatten3dBy {
109105
* var out = flatten3dBy( x, [ 2, 1, 2 ], true, scale );
110106
* // returns [ 2, 6, 4, 8 ]
111107
*/
112-
<T = unknown, U = unknown, V = unknown>( x: Array3D<T>, shape: Collection<number>, colexicographic: boolean, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Array<T>;
108+
<T = unknown, U = unknown, V = unknown>( x: Array3D<T>, shape: Shape3D, colexicographic: boolean, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Array<T>;
113109

114110
/**
115111
* Flattens a three-dimensional nested array according to a callback function and assigns elements to a provided output array.
@@ -152,7 +148,7 @@ interface Flatten3dBy {
152148
* var out = flatten3dBy.assign( x, [ 2, 1, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
153149
* // returns <Float64Array>[ 2, 6, 4, 8 ]
154150
*/
155-
assign<T = unknown, U = unknown, V = unknown, W = unknown>( x: Array3D<T>, shape: Collection<number>, colexicographic: boolean, out: Collection<V>, stride: number, offset: number, clbk: Callback<T, U, W>, thisArg?: ThisParameterType<Callback<T, U, W>> ): Collection<U | V>;
151+
assign<T = unknown, U = unknown, V = unknown, W = unknown>( x: Array3D<T>, shape: Shape3D, colexicographic: boolean, out: Collection<V>, stride: number, offset: number, clbk: Callback<T, U, W>, thisArg?: ThisParameterType<Callback<T, U, W>> ): Collection<U | V>;
156152
}
157153

158154
/**

base/flatten3d/docs/types/index.d.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
24-
25-
/**
26-
* Three-dimensional nested array.
27-
*/
28-
type Array3D<T> = Array<Array<Collection<T>>>;
23+
import { Collection, Array3D } from '@stdlib/types/array';
24+
import { Shape3D } from '@stdlib/types/ndarray';
2925

3026
/**
3127
* Interface describing `flatten3d`.
@@ -55,7 +51,7 @@ interface Flatten3d {
5551
* var out = flatten3d( x, [ 2, 1, 2 ], true );
5652
* // returns [ 1, 3, 2, 4 ]
5753
*/
58-
<T = unknown>( x: Array3D<T>, shape: Collection<number>, colexicographic: boolean ): Array<T>;
54+
<T = unknown>( x: Array3D<T>, shape: Shape3D, colexicographic: boolean ): Array<T>;
5955

6056
/**
6157
* Flattens a three-dimensional nested array and assigns elements to a provided output array.
@@ -88,7 +84,7 @@ interface Flatten3d {
8884
* var out = flatten3d.assign( x, [ 2, 1, 2 ], true, new Float64Array( 4 ), 1, 0 );
8985
* // returns <Float64Array>[ 1, 3, 2, 4 ]
9086
*/
91-
assign<T = unknown, U = unknown>( x: Array3D<T>, shape: Collection<number>, colexicographic: boolean, out: Collection<U>, stride: number, offset: number ): Collection<T | U>;
87+
assign<T = unknown, U = unknown>( x: Array3D<T>, shape: Shape3D, colexicographic: boolean, out: Collection<U>, stride: number, offset: number ): Collection<T | U>;
9288
}
9389

9490
/**

base/flatten4d-by/docs/types/index.d.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
24-
25-
/**
26-
* Four-dimensional nested array.
27-
*/
28-
type Array4D<T> = Array<Array<Array<Collection<T>>>>;
23+
import { Collection, Array4D } from '@stdlib/types/array';
24+
import { Shape4D } from '@stdlib/types/ndarray';
2925

3026
/**
3127
* Nullary callback function.
@@ -109,7 +105,7 @@ interface Flatten4dBy {
109105
* var out = flatten4dBy( x, [ 2, 1, 1, 2 ], true, scale );
110106
* // returns [ 2, 6, 4, 8 ]
111107
*/
112-
<T = unknown, U = unknown, V = unknown>( x: Array4D<T>, shape: Collection<number>, colexicographic: boolean, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Array<U>;
108+
<T = unknown, U = unknown, V = unknown>( x: Array4D<T>, shape: Shape4D, colexicographic: boolean, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Array<U>;
113109

114110
/**
115111
* Flattens a four-dimensional nested array according to a callback function and assigns elements to a provided output array.
@@ -152,7 +148,7 @@ interface Flatten4dBy {
152148
* var out = flatten4dBy.assign( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
153149
* // returns <Float64Array>[ 2, 6, 4, 8 ]
154150
*/
155-
assign<T = unknown, U = unknown, V = unknown, W = unknown>( x: Array4D<T>, shape: Collection<number>, colexicographic: boolean, out: Collection<V>, stride: number, offset: number, clbk: Callback<T, U, W>, thisArg?: ThisParameterType<Callback<T, U, W>> ): Collection<U | V>;
151+
assign<T = unknown, U = unknown, V = unknown, W = unknown>( x: Array4D<T>, shape: Shape4D, colexicographic: boolean, out: Collection<V>, stride: number, offset: number, clbk: Callback<T, U, W>, thisArg?: ThisParameterType<Callback<T, U, W>> ): Collection<U | V>;
156152
}
157153

158154
/**

base/flatten4d/docs/types/index.d.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
24-
25-
/**
26-
* Four-dimensional nested array.
27-
*/
28-
type Array4D<T> = Array<Array<Array<Collection<T>>>>;
23+
import { Collection, Array4D } from '@stdlib/types/array';
24+
import { Shape4D } from '@stdlib/types/ndarray';
2925

3026
/**
3127
* Interface describing `flatten4d`.
@@ -55,7 +51,7 @@ interface Flatten4d {
5551
* var out = flatten4d( x, [ 2, 1, 1, 2 ], true );
5652
* // returns [ 1, 3, 2, 4 ]
5753
*/
58-
<T = unknown>( x: Array4D<T>, shape: Collection<number>, colexicographic: boolean ): Array<T>;
54+
<T = unknown>( x: Array4D<T>, shape: Shape4D, colexicographic: boolean ): Array<T>;
5955

6056
/**
6157
* Flattens a four-dimensional nested array and assigns elements to a provided output array.
@@ -88,7 +84,7 @@ interface Flatten4d {
8884
* var out = flatten4d.assign( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0 );
8985
* // returns <Float64Array>[ 1, 3, 2, 4 ]
9086
*/
91-
assign<T = unknown, U = unknown>( x: Array4D<T>, shape: Collection<number>, colexicographic: boolean, out: Collection<U>, stride: number, offset: number ): Collection<T | U>;
87+
assign<T = unknown, U = unknown>( x: Array4D<T>, shape: Shape4D, colexicographic: boolean, out: Collection<U>, stride: number, offset: number ): Collection<T | U>;
9288
}
9389

9490
/**

base/flatten5d-by/docs/types/index.d.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
24-
25-
/**
26-
* Five-dimensional nested array.
27-
*/
28-
type Array5D<T> = Array<Array<Array<Array<Collection<T>>>>>;
23+
import { Collection, Array5D } from '@stdlib/types/array';
24+
import { Shape5D } from '@stdlib/types/ndarray';
2925

3026
/**
3127
* Nullary callback function.
@@ -109,7 +105,7 @@ interface Flatten5dBy {
109105
* var out = flatten5dBy( x, [ 2, 1, 1, 1, 2 ], true, scale );
110106
* // returns [ 1, 3, 2, 4 ]
111107
*/
112-
<T = unknown, U = unknown, V = unknown>( x: Array5D<T>, shape: Collection<number>, colexicographic: boolean, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Array<U>;
108+
<T = unknown, U = unknown, V = unknown>( x: Array5D<T>, shape: Shape5D, colexicographic: boolean, clbk: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>> ): Array<U>;
113109

114110
/**
115111
* Flattens a five-dimensional nested array according to a callback function and assigns elements to a provided output array.
@@ -152,7 +148,7 @@ interface Flatten5dBy {
152148
* var out = flatten5dBy.assign( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
153149
* // returns <Float64Array>[ 1, 3, 2, 4 ]
154150
*/
155-
assign<T = unknown, U = unknown, V = unknown, W = unknown>( x: Array5D<T>, shape: Collection<number>, colexicographic: boolean, out: Collection<V>, stride: number, offset: number, clbk: Callback<T, U, W>, thisArg?: ThisParameterType<Callback<T, U, W>> ): Collection<U | V>;
151+
assign<T = unknown, U = unknown, V = unknown, W = unknown>( x: Array5D<T>, shape: Shape5D, colexicographic: boolean, out: Collection<V>, stride: number, offset: number, clbk: Callback<T, U, W>, thisArg?: ThisParameterType<Callback<T, U, W>> ): Collection<U | V>;
156152
}
157153

158154
/**

base/flatten5d/docs/types/index.d.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
24-
25-
/**
26-
* Five-dimensional nested array.
27-
*/
28-
type Array5D<T> = Array<Array<Array<Array<Collection<T>>>>>;
23+
import { Collection, Array5D } from '@stdlib/types/array';
24+
import { Shape5D } from '@stdlib/types/ndarray';
2925

3026
/**
3127
* Interface describing `flatten5d`.
@@ -55,7 +51,7 @@ interface Flatten5d {
5551
* var out = flatten5d( x, [ 2, 1, 1, 1, 2 ], true );
5652
* // returns [ 1, 3, 2, 4 ]
5753
*/
58-
<T = unknown>( x: Array5D<T>, shape: Collection<number>, colexicographic: boolean ): Array<T>;
54+
<T = unknown>( x: Array5D<T>, shape: Shape5D, colexicographic: boolean ): Array<T>;
5955

6056
/**
6157
* Flattens a five-dimensional nested array and assigns elements to a provided output array.
@@ -88,7 +84,7 @@ interface Flatten5d {
8884
* var out = flatten5d.assign( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0 );
8985
* // returns <Float64Array>[ 1, 3, 2, 4 ]
9086
*/
91-
assign<T = unknown, U = unknown>( x: Array5D<T>, shape: Collection<number>, colexicographic: boolean, out: Collection<U>, stride: number, offset: number ): Collection<T | U>;
87+
assign<T = unknown, U = unknown>( x: Array5D<T>, shape: Shape5D, colexicographic: boolean, out: Collection<U>, stride: number, offset: number ): Collection<T | U>;
9288
}
9389

9490
/**

base/getter/docs/types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ declare function getter( dtype: 'uint8c' ): GetUint8c;
287287
* var v = get( arr, 2 );
288288
* // returns 3
289289
*/
290-
declare function getter( dtype: 'generic' ): GetGeneric<any>;
290+
declare function getter<T = unknown>( dtype: 'generic' ): GetGeneric<T>; // tslint:disable-line:no-unnecessary-generics
291291

292292
/**
293293
* Returns an accessor function for retrieving an element from an indexed array-like object.
@@ -304,7 +304,7 @@ declare function getter( dtype: 'generic' ): GetGeneric<any>;
304304
* var v = get( arr, 2 );
305305
* // returns 3
306306
*/
307-
declare function getter( dtype: string ): GetArrayLike<any>;
307+
declare function getter<T = unknown>( dtype: string ): GetArrayLike<T>; // tslint:disable-line:no-unnecessary-generics
308308

309309

310310
// EXPORTS //

base/getter/docs/types/test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import getter = require( './index' );
3232
getter( 'uint16' ); // $ExpectType GetUint16
3333
getter( 'uint8' ); // $ExpectType GetUint8
3434
getter( 'uint8c' ); // $ExpectType GetUint8c
35-
getter( 'generic' ); // $ExpectType GetGeneric<any>
36-
getter( 'foo' ); // $ExpectType GetArrayLike<any>
35+
getter<any>( 'generic' ); // $ExpectType GetGeneric<any>
36+
getter<number>( 'foo' ); // $ExpectType GetArrayLike<number>
3737
}
3838

3939
// The compiler throws an error if the function is provided a first argument which is not a string...
@@ -55,9 +55,9 @@ import getter = require( './index' );
5555

5656
// The function returns a function which returns an array element...
5757
{
58-
const get1 = getter( 'generic' );
58+
const get1 = getter<number>( 'generic' );
5959
const x1 = [ 1, 2, 3, 4 ];
60-
get1( x1, 2 ); // $ExpectType any
60+
get1( x1, 2 ); // $ExpectType number | void
6161

6262
const get2 = getter( 'float64' );
6363
const x2 = new Float64Array( [ 1, 2, 3, 4 ] );
@@ -97,7 +97,7 @@ import getter = require( './index' );
9797

9898
const get11 = getter( 'foo' );
9999
const x11 = [ 1, 2, 3, 4 ];
100-
get11( x11, 2 ); // $ExpectType any
100+
get11( x11, 2 ); // $ExpectType unknown
101101
}
102102

103103
// The compiler throws an error if the returned function is provided a first argument which is not a collection...

0 commit comments

Comments
 (0)