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 Jun 27, 2023
1 parent 02c373d commit 86fc789
Show file tree
Hide file tree
Showing 19 changed files with 80 additions and 38 deletions.
4 changes: 2 additions & 2 deletions base/accessor-getter/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type GetComplex64 = ( arr: Complex64Array, idx: number ) => Complex64 | void;
* @param idx - element index
* @returns element value
*/
type GetArrayLike = ( arr: AccessorArrayLike<any>, idx: number ) => any;
type GetArrayLike<T> = ( arr: AccessorArrayLike<T>, idx: number ) => T;

/**
* Returns an accessor function for retrieving an element from a `Complex128Array`.
Expand Down Expand Up @@ -125,7 +125,7 @@ declare function getter( dtype: 'complex64' ): GetComplex64;
* var v = get( arr, 2 );
* // returns 3
*/
declare function getter( dtype: string ): GetArrayLike;
declare function getter( dtype: string ): GetArrayLike<any>;


// EXPORTS //
Expand Down
2 changes: 1 addition & 1 deletion base/accessor-getter/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function accessorArray(): AccessorArrayLike<number> {
{
getter( 'complex128' ); // $ExpectType GetComplex128
getter( 'complex64' ); // $ExpectType GetComplex64
getter( 'foo' ); // $ExpectType GetArrayLike
getter( 'foo' ); // $ExpectType GetArrayLike<any>
}

// The compiler throws an error if the function is provided a first argument which is not a string...
Expand Down
4 changes: 2 additions & 2 deletions base/accessor-setter/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type SetComplex64 = ( arr: Complex64Array, idx: number, value: ComplexLike ) =>
* @param idx - element index
* @param value - value to set
*/
type SetArrayLike = ( arr: AccessorArrayLike<any>, idx: number, value: any ) => void; // tslint:disable-line:max-line-length
type SetArrayLike<T> = ( arr: AccessorArrayLike<T>, idx: number, value: T ) => void; // tslint:disable-line:max-line-length

/**
* Returns an accessor function for setting an element in a `Complex128Array`.
Expand Down Expand Up @@ -132,7 +132,7 @@ declare function setter( dtype: 'complex64' ): SetComplex64;
* var v = arr.get( 2 );
* // returns 3
*/
declare function setter( dtype: string ): SetArrayLike;
declare function setter( dtype: string ): SetArrayLike<any>;


// EXPORTS //
Expand Down
2 changes: 1 addition & 1 deletion base/accessor-setter/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function accessorArray(): AccessorArrayLike<number> {
{
setter( 'complex128' ); // $ExpectType SetComplex128
setter( 'complex64' ); // $ExpectType SetComplex64
setter( 'foo' ); // $ExpectType SetArrayLike
setter( 'foo' ); // $ExpectType SetArrayLike<any>
}

// The compiler throws an error if the function is provided a first argument which is not a string...
Expand Down
6 changes: 3 additions & 3 deletions base/cartesian-power/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
* limitations under the License.
*/

// TypeScript Version: 2.0
// TypeScript Version: 4.1

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

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

/**
* Returns the Cartesian power.
Expand All @@ -40,7 +40,7 @@ import { ArrayLike } from '@stdlib/types/array';
* var out = cartesianPower( x, 2 );
* // returns [ [ 1, 1 ], [ 1, 2 ], [ 2, 1 ], [ 2, 2 ] ]
*/
declare function cartesianPower<T>( x: ArrayLike<T>, n: number ): Array<Array<T>>; // tslint:disable-line:max-line-length
declare function cartesianPower<T = any>( x: Collection<T>, n: number ): Array<Array<T>>; // tslint:disable-line:max-line-length


// EXPORTS //
Expand Down
1 change: 0 additions & 1 deletion base/cartesian-power/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import cartesianPower = require( './index' );
cartesianPower( [ 1, 2, 3, 4 ], 3 ); // $ExpectType number[][]
cartesianPower<number>( [ 1, 2, 3, 4 ], 3 ); // $ExpectType number[][]
cartesianPower<string>( [ '1', '2', '3', '4' ], 3 ); // $ExpectType string[][]
cartesianPower<any>( [ 1, 2, 3, 4 ], 3 ); // $ExpectType any[][]
}

// The compiler throws an error if the function is provided a first argument which is not an array-like object...
Expand Down
6 changes: 3 additions & 3 deletions base/cartesian-square/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
* limitations under the License.
*/

// TypeScript Version: 2.0
// TypeScript Version: 4.1

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

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

/**
* Returns the Cartesian square.
Expand All @@ -38,7 +38,7 @@ import { ArrayLike } from '@stdlib/types/array';
* var out = cartesianSquare( x );
* // returns [ [ 1, 1 ], [ 1, 2 ], [ 2, 1 ], [ 2, 2 ] ]
*/
declare function cartesianSquare<T>( x: ArrayLike<T> ): Array<Array<T>>;
declare function cartesianSquare<T = any>( x: Collection<T> ): Array<Array<T>>;


// EXPORTS //
Expand Down
1 change: 0 additions & 1 deletion base/cartesian-square/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import cartesianSquare = require( './index' );
cartesianSquare( [ 1, 2, 3, 4 ] ); // $ExpectType number[][]
cartesianSquare<number>( [ 1, 2, 3, 4 ] ); // $ExpectType number[][]
cartesianSquare<string>( [ '1', '2', '3', '4' ] ); // $ExpectType string[][]
cartesianSquare<any>( [ 1, 2, 3, 4 ] ); // $ExpectType any[][]
}

// The compiler throws an error if the function is provided a first argument which is not an array-like object...
Expand Down
4 changes: 2 additions & 2 deletions base/copy-indexed/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

// TypeScript Version: 2.0
// TypeScript Version: 4.1

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

Expand All @@ -34,7 +34,7 @@ import { Collection } from '@stdlib/types/object';
* var out = copy( x );
* // returns [ 1, 2, 3 ]
*/
declare function copy( x: Collection ): Array<any>;
declare function copy<T = any>( x: Collection<T> ): Array<T>;


// EXPORTS //
Expand Down
2 changes: 1 addition & 1 deletion base/copy-indexed/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import copy = require( './index' );

// The function returns an array...
{
copy( [ 1, 2, 3 ] ); // $ExpectType any[]
copy( [ 1, 2, 3 ] ); // $ExpectType number[]
}

// The compiler throws an error if the function is provided an argument which is not a collection...
Expand Down
4 changes: 2 additions & 2 deletions base/copy/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

// TypeScript Version: 2.0
// TypeScript Version: 4.1

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

Expand All @@ -34,7 +34,7 @@ import { Collection } from '@stdlib/types/object';
* var out = copy( x );
* // returns [ 1, 2, 3 ]
*/
declare function copy( x: Collection ): Array<any>;
declare function copy<T = any>( x: Collection<T> ): Array<T>;


// EXPORTS //
Expand Down
2 changes: 1 addition & 1 deletion base/copy/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import copy = require( './index' );

// The function returns an array...
{
copy( [ 1, 2, 3 ] ); // $ExpectType any[]
copy( [ 1, 2, 3 ] ); // $ExpectType number[]
}

// The compiler throws an error if the function is provided an argument which is not a collection...
Expand Down
10 changes: 5 additions & 5 deletions base/getter/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

// TypeScript Version: 2.0
// TypeScript Version: 4.1

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

Expand Down Expand Up @@ -110,7 +110,7 @@ type GetUint8c = ( arr: Uint8ClampedArray, idx: number ) => number | void;
* @param idx - element index
* @returns element value
*/
type GetGeneric = ( arr: Array<any>, idx: number ) => any;
type GetGeneric<T> = ( arr: Array<T>, idx: number ) => T | void;

/**
* Returns an element from an indexed array-like object.
Expand All @@ -119,7 +119,7 @@ type GetGeneric = ( arr: Array<any>, idx: number ) => any;
* @param idx - element index
* @returns element value
*/
type GetArrayLike = ( arr: Collection, idx: number ) => any;
type GetArrayLike<T> = ( arr: Collection<T>, idx: number ) => T | void;

/**
* Returns an accessor function for retrieving an element from a `Float64Array`.
Expand Down 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;
declare function getter( dtype: 'generic' ): GetGeneric<any>;

/**
* 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;
* var v = get( arr, 2 );
* // returns 3
*/
declare function getter( dtype: string ): GetArrayLike;
declare function getter( dtype: string ): GetArrayLike<any>;


// EXPORTS //
Expand Down
4 changes: 2 additions & 2 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
getter( 'foo' ); // $ExpectType GetArrayLike
getter( 'generic' ); // $ExpectType GetGeneric<any>
getter( 'foo' ); // $ExpectType GetArrayLike<any>
}

// The compiler throws an error if the function is provided a first argument which is not a string...
Expand Down
2 changes: 1 addition & 1 deletion base/last/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

// TypeScript Version: 2.0
// TypeScript Version: 4.1

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

Expand Down
46 changes: 44 additions & 2 deletions base/n-cartesian-product/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,54 @@
* limitations under the License.
*/

// TypeScript Version: 2.0
// TypeScript Version: 4.1

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

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

/**
* Returns the n-fold Cartesian product.
*
* ## Notes
*
* - If provided one or more empty arrays, the function returns an empty array.
*
* @param x1 - first input array
* @param x2 - second input array
* @returns Cartesian product
*
* @example
* var x1 = [ 1, 2, 3 ];
* var x2 = [ 4, 5 ];
*
* var out = nCartesianProduct( x1, x2 );
* // returns [ [ 1, 4 ], [ 1, 5 ], [ 2, 4 ], [ 2, 5 ], [ 3, 4 ], [ 3, 5 ] ]
*/
declare function nCartesianProduct<T = any, U = any>( x1: Collection<T>, x2: Collection<U> ): Array<[T, U]>; // tslint:disable-line:max-line-length

/**
* Returns the n-fold Cartesian product.
*
* ## Notes
*
* - If provided one or more empty arrays, the function returns an empty array.
*
* @param x1 - first input array
* @param x2 - second input array
* @param x3 - third input array
* @returns Cartesian product
*
* @example
* var x1 = [ 1, 2, 3 ];
* var x2 = [ 4, 5 ];
* var x3 = [ 6 ];
*
* var out = nCartesianProduct( x1, x2, x3 );
* // returns [ [ 1, 4, 6 ], [ 1, 5, 6 ], [ 2, 4, 6 ], [ 2, 5, 6 ], [ 3, 4, 6 ], [ 3, 5, 6 ] ]
*/
declare function nCartesianProduct<T = any, U = any, V = any>( x1: Collection<T>, x2: Collection<U>, x3: Collection<V> ): Array<[T, U, V]>; // tslint:disable-line:max-line-length

/**
* Returns the n-fold Cartesian product.
*
Expand All @@ -41,7 +83,7 @@ import { Collection } from '@stdlib/types/object';
* var out = nCartesianProduct( x1, x2 );
* // returns [ [ 1, 4 ], [ 1, 5 ], [ 2, 4 ], [ 2, 5 ], [ 3, 4 ], [ 3, 5 ] ]
*/
declare function nCartesianProduct( x1: Collection, x2: Collection, ...xN: Array<Collection> ): Array<Array<any>>; // tslint:disable-line:max-line-length
declare function nCartesianProduct<T = any, U = any, V = any>( x1: Collection<T>, x2: Collection<U>, ...xN: Array<Collection<V>> ): Array<Array<T | U | V>>; // tslint:disable-line:max-line-length


// EXPORTS //
Expand Down
4 changes: 3 additions & 1 deletion base/n-cartesian-product/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import nCartesianProduct = require( './index' );

// The function returns an array of arrays...
{
nCartesianProduct( [ 1, 2, 3, 4 ], [ 1, 3 ] ); // $ExpectType any[][]
nCartesianProduct( [ 1, 2, 3, 4 ], [ 1, 3 ] ); // $ExpectType [number, number][]
nCartesianProduct( [ 1, 2, 3, 4 ], [ 1, 3 ], [ 6 ] ); // $ExpectType [number, number, number][]
nCartesianProduct( [ 1, 2, 3, 4 ], [ 1, 3 ], [ 6 ], [ 7 ] ); // $ExpectType number[][]
}

// The compiler throws an error if the function is provided a first argument which is not an array-like object...
Expand Down
10 changes: 5 additions & 5 deletions base/setter/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

// TypeScript Version: 2.0
// TypeScript Version: 4.1

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

Expand Down Expand Up @@ -110,7 +110,7 @@ type SetUint8c = ( arr: Uint8ClampedArray, idx: number, value: number ) => void;
* @param idx - element index
* @param value - value to set
*/
type SetGeneric = ( arr: Array<any>, idx: number, value: any ) => void;
type SetGeneric<T> = ( arr: Array<T>, idx: number, value: T ) => void;

/**
* Sets an element in an indexed array-like object.
Expand All @@ -119,7 +119,7 @@ type SetGeneric = ( arr: Array<any>, idx: number, value: any ) => void;
* @param idx - element index
* @param value - value to set
*/
type SetArrayLike = ( arr: Collection, idx: number, value: any ) => void;
type SetArrayLike<T> = ( arr: Collection<T>, idx: number, value: T ) => void;

/**
* Returns an accessor function for setting an element in a `Float64Array`.
Expand Down Expand Up @@ -307,7 +307,7 @@ declare function setter( dtype: 'uint8c' ): SetUint8c;
* var v = arr[ 2 ];
* // returns 3
*/
declare function setter( dtype: 'generic' ): SetGeneric;
declare function setter( dtype: 'generic' ): SetGeneric<any>;

/**
* Returns an accessor function for setting an element in an indexed array-like object.
Expand All @@ -326,7 +326,7 @@ declare function setter( dtype: 'generic' ): SetGeneric;
* var v = arr[ 2 ];
* // returns 3
*/
declare function setter( dtype: string ): SetArrayLike;
declare function setter( dtype: string ): SetArrayLike<any>;


// EXPORTS //
Expand Down
4 changes: 2 additions & 2 deletions base/setter/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import setter = require( './index' );
setter( 'uint16' ); // $ExpectType SetUint16
setter( 'uint8' ); // $ExpectType SetUint8
setter( 'uint8c' ); // $ExpectType SetUint8c
setter( 'generic' ); // $ExpectType SetGeneric
setter( 'foo' ); // $ExpectType SetArrayLike
setter( 'generic' ); // $ExpectType SetGeneric<any>
setter( 'foo' ); // $ExpectType SetArrayLike<any>
}

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

0 comments on commit 86fc789

Please sign in to comment.