Skip to content

Commit c8d8f59

Browse files
committed
Update return types and add table interface
1 parent 2d39468 commit c8d8f59

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

lib/node_modules/@stdlib/array/promotion-rules/docs/types/index.d.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818

1919
// TypeScript Version: 2.0
2020

21+
/**
22+
* Interface describing a promotion table.
23+
*/
24+
interface Table {
25+
// Table properties:
26+
[key: string]: string | number;
27+
}
28+
2129
/**
2230
* Returns the array data type with the smallest size and closest "kind" to which array data types can be safely cast.
2331
*
@@ -33,7 +41,7 @@
3341
* var dt = promotionRules( 'float32', 'foo' );
3442
* // returns null
3543
*/
36-
declare function promotionRules( dtype1: string, dtype2: string ): any;
44+
declare function promotionRules( dtype1: string, dtype2: string ): number | string | null; // tslint-disable-line max-line-length
3745

3846
/**
3947
* Returns a type promotion table displaying array data types with the smallest size and closest "kind" to which array data types can be safely cast.
@@ -44,7 +52,7 @@ declare function promotionRules( dtype1: string, dtype2: string ): any;
4452
* var table = promotionRules();
4553
* // returns {...}
4654
*/
47-
declare function promotionRules(): any;
55+
declare function promotionRules(): Table;
4856

4957

5058
// EXPORTS //

lib/node_modules/@stdlib/array/promotion-rules/docs/types/test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import promotionRules = require( './index' );
2323

2424
// The function returns an object, array of strings, or null...
2525
{
26-
promotionRules(); // $ExpectType any
27-
promotionRules( 'float32', 'uint32' ); // $ExpectType any
28-
promotionRules( 'int32', 'generic' ); // $ExpectType any
29-
promotionRules( 'float32', 'foo' ); // $ExpectType any
26+
promotionRules(); // $ExpectType Table
27+
promotionRules( 'float32', 'uint32' ); // $ExpectType string | number | null
28+
promotionRules( 'int32', 'generic' ); // $ExpectType string | number | null
29+
promotionRules( 'float32', 'foo' ); // $ExpectType string | number | null
3030
}
3131

3232
// The function does not compile if provided a first argument that is not a string...

lib/node_modules/@stdlib/ndarray/promotion-rules/docs/types/index.d.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818

1919
// TypeScript Version: 2.0
2020

21+
/**
22+
* Interface describing a promotion table.
23+
*/
24+
interface Table {
25+
// Table properties:
26+
[key: string]: string | number;
27+
}
28+
2129
/**
2230
* Returns the ndarray data type with the smallest size and closest "kind" to which ndarray data types can be safely cast.
2331
*
@@ -37,7 +45,7 @@
3745
* var dt = promotionRules( 'float32', 'foo' );
3846
* // returns null
3947
*/
40-
declare function promotionRules( dtype1: string, dtype2: string ): any;
48+
declare function promotionRules( dtype1: string, dtype2: string ): number | string | null; // tslint-disable-line max-line-length
4149

4250
/**
4351
* Returns a type promotion table displaying the ndarray data types with the smallest size and closest "kind" to which ndarray data types can be safely cast.
@@ -48,7 +56,7 @@ declare function promotionRules( dtype1: string, dtype2: string ): any;
4856
* var table = promotionRules();
4957
* // returns {...}
5058
*/
51-
declare function promotionRules(): any;
59+
declare function promotionRules(): Table;
5260

5361

5462
// EXPORTS //

lib/node_modules/@stdlib/ndarray/promotion-rules/docs/types/test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import promotionRules = require( './index' );
2323

2424
// The function returns an object, array of strings, or null...
2525
{
26-
promotionRules(); // $ExpectType any
27-
promotionRules( 'float32', 'uint32' ); // $ExpectType any
28-
promotionRules( 'binary', 'generic' ); // $ExpectType any
29-
promotionRules( 'float32', 'foo' ); // $ExpectType any
26+
promotionRules(); // $ExpectType Table
27+
promotionRules( 'float32', 'uint32' ); // $ExpectType string | number | null
28+
promotionRules( 'binary', 'generic' ); // $ExpectType string | number | null
29+
promotionRules( 'float32', 'foo' ); // $ExpectType string | number | null
3030
}
3131

3232
// The function does not compile if provided a first argument that is not a string...

0 commit comments

Comments
 (0)