Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Aug 24, 2023
1 parent 8673ec5 commit 0ec1cf6
Show file tree
Hide file tree
Showing 20 changed files with 55 additions and 139 deletions.
54 changes: 1 addition & 53 deletions base/flatten-by/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,59 +22,7 @@

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

import { Collection } from '@stdlib/types/array';

// FIXME: shapes should be collections of a defined length

/**
* One-dimensional array.
*/
type Array1D<T> = Collection<T>;

/**
* Two-dimensional array.
*/
type Array2D<T> = Array<Array1D<T>>;

/**
* Three-dimensional array.
*/
type Array3D<T> = Array<Array2D<T>>;

/**
* Four-dimensional array.
*/
type Array4D<T> = Array<Array3D<T>>;

/**
* Five-dimensional array.
*/
type Array5D<T> = Array<Array4D<T>>;

/**
* Six-dimensional array.
*/
type Array6D<T> = Array<Array5D<T>>;

/**
* Seven-dimensional array.
*/
type Array7D<T> = Array<Array6D<T>>;

/**
* Eight-dimensional array.
*/
type Array8D<T> = Array<Array7D<T>>;

/**
* Nine-dimensional array.
*/
type Array9D<T> = Array<Array8D<T>>;

/**
* Ten-dimensional array.
*/
type Array10D<T> = Array<Array9D<T>>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes
import { Collection, Array1D, Array2D, Array3D, Array4D, Array5D, Array6D, Array7D, Array8D, Array9D, Array10D } from '@stdlib/types/array';

/**
* One-dimensional array shape.
Expand Down
12 changes: 4 additions & 8 deletions base/flatten2d-by/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@

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

import { Collection } from '@stdlib/types/array';

/**
* Two-dimensional nested array.
*/
type Array2D<T> = Array<Collection<T>>;
import { Collection, Array2D } from '@stdlib/types/array';
import { Shape2D } from '@stdlib/types/ndarray';

/**
* Nullary callback function.
Expand Down Expand Up @@ -109,7 +105,7 @@ interface Flatten2dBy {
* var out = flatten2dBy( x, [ 2, 2 ], true, scale );
* // returns [ 2, 6, 4, 8 ]
*/
<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>;
<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>;


/**
Expand Down Expand Up @@ -153,7 +149,7 @@ interface Flatten2dBy {
* var out = flatten2dBy( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns <Float64Array>[ 2, 6, 4, 8 ]
*/
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>;
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>;
}

/**
Expand Down
12 changes: 4 additions & 8 deletions base/flatten2d/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@

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

import { Collection } from '@stdlib/types/array';

/**
* Two-dimensional nested array.
*/
type Array2D<T> = Array<Collection<T>>;
import { Collection, Array2D } from '@stdlib/types/array';
import { Shape2D } from '@stdlib/types/ndarray';

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

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

/**
Expand Down
12 changes: 4 additions & 8 deletions base/flatten3d-by/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@

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

import { Collection } from '@stdlib/types/array';

/**
* Three-dimensional nested array.
*/
type Array3D<T> = Array<Array<Collection<T>>>;
import { Collection, Array3D } from '@stdlib/types/array';
import { Shape3D } from '@stdlib/types/ndarray';

/**
* Nullary callback function.
Expand Down Expand Up @@ -109,7 +105,7 @@ interface Flatten3dBy {
* var out = flatten3dBy( x, [ 2, 1, 2 ], true, scale );
* // returns [ 2, 6, 4, 8 ]
*/
<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>;
<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>;

/**
* Flattens a three-dimensional nested array according to a callback function and assigns elements to a provided output array.
Expand Down Expand Up @@ -152,7 +148,7 @@ interface Flatten3dBy {
* var out = flatten3dBy.assign( x, [ 2, 1, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns <Float64Array>[ 2, 6, 4, 8 ]
*/
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>;
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>;
}

/**
Expand Down
12 changes: 4 additions & 8 deletions base/flatten3d/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@

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

import { Collection } from '@stdlib/types/array';

/**
* Three-dimensional nested array.
*/
type Array3D<T> = Array<Array<Collection<T>>>;
import { Collection, Array3D } from '@stdlib/types/array';
import { Shape3D } from '@stdlib/types/ndarray';

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

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

/**
Expand Down
12 changes: 4 additions & 8 deletions base/flatten4d-by/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@

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

import { Collection } from '@stdlib/types/array';

/**
* Four-dimensional nested array.
*/
type Array4D<T> = Array<Array<Array<Collection<T>>>>;
import { Collection, Array4D } from '@stdlib/types/array';
import { Shape4D } from '@stdlib/types/ndarray';

/**
* Nullary callback function.
Expand Down Expand Up @@ -109,7 +105,7 @@ interface Flatten4dBy {
* var out = flatten4dBy( x, [ 2, 1, 1, 2 ], true, scale );
* // returns [ 2, 6, 4, 8 ]
*/
<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>;
<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>;

/**
* Flattens a four-dimensional nested array according to a callback function and assigns elements to a provided output array.
Expand Down Expand Up @@ -152,7 +148,7 @@ interface Flatten4dBy {
* var out = flatten4dBy.assign( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns <Float64Array>[ 2, 6, 4, 8 ]
*/
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>;
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>;
}

/**
Expand Down
12 changes: 4 additions & 8 deletions base/flatten4d/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@

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

import { Collection } from '@stdlib/types/array';

/**
* Four-dimensional nested array.
*/
type Array4D<T> = Array<Array<Array<Collection<T>>>>;
import { Collection, Array4D } from '@stdlib/types/array';
import { Shape4D } from '@stdlib/types/ndarray';

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

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

/**
Expand Down
12 changes: 4 additions & 8 deletions base/flatten5d-by/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@

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

import { Collection } from '@stdlib/types/array';

/**
* Five-dimensional nested array.
*/
type Array5D<T> = Array<Array<Array<Array<Collection<T>>>>>;
import { Collection, Array5D } from '@stdlib/types/array';
import { Shape5D } from '@stdlib/types/ndarray';

/**
* Nullary callback function.
Expand Down Expand Up @@ -109,7 +105,7 @@ interface Flatten5dBy {
* var out = flatten5dBy( x, [ 2, 1, 1, 1, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
<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>;
<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>;

/**
* Flattens a five-dimensional nested array according to a callback function and assigns elements to a provided output array.
Expand Down Expand Up @@ -152,7 +148,7 @@ interface Flatten5dBy {
* var out = flatten5dBy.assign( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns <Float64Array>[ 1, 3, 2, 4 ]
*/
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>;
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>;
}

/**
Expand Down
12 changes: 4 additions & 8 deletions base/flatten5d/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@

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

import { Collection } from '@stdlib/types/array';

/**
* Five-dimensional nested array.
*/
type Array5D<T> = Array<Array<Array<Array<Collection<T>>>>>;
import { Collection, Array5D } from '@stdlib/types/array';
import { Shape5D } from '@stdlib/types/ndarray';

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

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

/**
Expand Down
4 changes: 2 additions & 2 deletions base/getter/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ declare function getter( dtype: 'uint8c' ): GetUint8c;
* var v = get( arr, 2 );
* // returns 3
*/
declare function getter( dtype: 'generic' ): GetGeneric<any>;
declare function getter<T = unknown>( dtype: 'generic' ): GetGeneric<T>; // tslint:disable-line:no-unnecessary-generics

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


// EXPORTS //
Expand Down
10 changes: 5 additions & 5 deletions base/getter/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import getter = require( './index' );
getter( 'uint16' ); // $ExpectType GetUint16
getter( 'uint8' ); // $ExpectType GetUint8
getter( 'uint8c' ); // $ExpectType GetUint8c
getter( 'generic' ); // $ExpectType GetGeneric<any>
getter( 'foo' ); // $ExpectType GetArrayLike<any>
getter<any>( 'generic' ); // $ExpectType GetGeneric<any>
getter<number>( 'foo' ); // $ExpectType GetArrayLike<number>
}

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

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

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

const get11 = getter( 'foo' );
const x11 = [ 1, 2, 3, 4 ];
get11( x11, 2 ); // $ExpectType any
get11( x11, 2 ); // $ExpectType unknown
}

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

0 comments on commit 0ec1cf6

Please sign in to comment.