File tree 4 files changed +28
-12
lines changed
array/promotion-rules/docs/types
ndarray/promotion-rules/docs/types
4 files changed +28
-12
lines changed Original file line number Diff line number Diff line change 18
18
19
19
// TypeScript Version: 2.0
20
20
21
+ /**
22
+ * Interface describing a promotion table.
23
+ */
24
+ interface Table {
25
+ // Table properties:
26
+ [ key : string ] : string | number ;
27
+ }
28
+
21
29
/**
22
30
* Returns the array data type with the smallest size and closest "kind" to which array data types can be safely cast.
23
31
*
33
41
* var dt = promotionRules( 'float32', 'foo' );
34
42
* // returns null
35
43
*/
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
37
45
38
46
/**
39
47
* 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;
44
52
* var table = promotionRules();
45
53
* // returns {...}
46
54
*/
47
- declare function promotionRules ( ) : any ;
55
+ declare function promotionRules ( ) : Table ;
48
56
49
57
50
58
// EXPORTS //
Original file line number Diff line number Diff line change @@ -23,10 +23,10 @@ import promotionRules = require( './index' );
23
23
24
24
// The function returns an object, array of strings, or null...
25
25
{
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
30
30
}
31
31
32
32
// The function does not compile if provided a first argument that is not a string...
Original file line number Diff line number Diff line change 18
18
19
19
// TypeScript Version: 2.0
20
20
21
+ /**
22
+ * Interface describing a promotion table.
23
+ */
24
+ interface Table {
25
+ // Table properties:
26
+ [ key : string ] : string | number ;
27
+ }
28
+
21
29
/**
22
30
* Returns the ndarray data type with the smallest size and closest "kind" to which ndarray data types can be safely cast.
23
31
*
37
45
* var dt = promotionRules( 'float32', 'foo' );
38
46
* // returns null
39
47
*/
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
41
49
42
50
/**
43
51
* 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;
48
56
* var table = promotionRules();
49
57
* // returns {...}
50
58
*/
51
- declare function promotionRules ( ) : any ;
59
+ declare function promotionRules ( ) : Table ;
52
60
53
61
54
62
// EXPORTS //
Original file line number Diff line number Diff line change @@ -23,10 +23,10 @@ import promotionRules = require( './index' );
23
23
24
24
// The function returns an object, array of strings, or null...
25
25
{
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
30
30
}
31
31
32
32
// The function does not compile if provided a first argument that is not a string...
You can’t perform that action at this time.
0 commit comments