@@ -23,10 +23,10 @@ import array = require( './index' );
23
23
24
24
// The function returns an ndarray...
25
25
{
26
- array ( [ [ 1 , 2 ] , [ 3 , 4 ] ] ) ; // $ExpectType ndarray
27
- array ( new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) , { 'shape' : [ 2 , 2 ] } ) ; // $ExpectType ndarray
28
- array ( { 'shape' : [ 2 , 2 ] } ) ; // $ExpectType ndarray
29
- array ( { 'buffer' : [ [ 1 , 2 ] , [ 3 , 4 ] ] } ) ; // $ExpectType ndarray
26
+ array < number > ( [ [ 1 , 2 ] , [ 3 , 4 ] ] ) ; // $ExpectType typedndarray<number>
27
+ array < number > ( new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) , { 'shape' : [ 2 , 2 ] } ) ; // $ExpectType typedndarray<number>
28
+ array < number > ( { 'shape' : [ 2 , 2 ] } ) ; // $ExpectType typedndarray<number>
29
+ array < number > ( { 'buffer' : [ [ 1 , 2 ] , [ 3 , 4 ] ] } ) ; // $ExpectType typedndarray<number>
30
30
}
31
31
32
32
// The compiler throws an error if the function is provided a first argument which is not an array, buffer, or options object...
@@ -41,6 +41,7 @@ import array = require( './index' );
41
41
// The compiler throws an error if the function is provided a second argument which is not an options object...
42
42
{
43
43
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
44
+
44
45
array ( buffer , 'abc' ) ; // $ExpectError
45
46
array ( buffer , true ) ; // $ExpectError
46
47
array ( buffer , false ) ; // $ExpectError
@@ -52,6 +53,7 @@ import array = require( './index' );
52
53
// The compiler throws an error if the function is provided a `dtype` option which is not a recognized data type...
53
54
{
54
55
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
56
+
55
57
array ( buffer , { 'dtype' : 'abc' } ) ; // $ExpectError
56
58
array ( buffer , { 'dtype' : 123 } ) ; // $ExpectError
57
59
array ( buffer , { 'dtype' : true } ) ; // $ExpectError
@@ -74,6 +76,7 @@ import array = require( './index' );
74
76
// The compiler throws an error if the function is provided an `order` option which is not a recognized order...
75
77
{
76
78
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
79
+
77
80
array ( buffer , { 'order' : 'abc' } ) ; // $ExpectError
78
81
array ( buffer , { 'order' : 123 } ) ; // $ExpectError
79
82
array ( buffer , { 'order' : true } ) ; // $ExpectError
@@ -96,6 +99,7 @@ import array = require( './index' );
96
99
// The compiler throws an error if the function is provided a `shape` option which is not an array-like object containing numbers...
97
100
{
98
101
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
102
+
99
103
array ( buffer , { 'shape' : 'abc' } ) ; // $ExpectError
100
104
array ( buffer , { 'shape' : 123 } ) ; // $ExpectError
101
105
array ( buffer , { 'shape' : true } ) ; // $ExpectError
@@ -116,6 +120,7 @@ import array = require( './index' );
116
120
// The compiler throws an error if the function is provided a `mode` option which is not a recognized mode...
117
121
{
118
122
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
123
+
119
124
array ( buffer , { 'mode' : 'abc' } ) ; // $ExpectError
120
125
array ( buffer , { 'mode' : 123 } ) ; // $ExpectError
121
126
array ( buffer , { 'mode' : true } ) ; // $ExpectError
@@ -138,6 +143,7 @@ import array = require( './index' );
138
143
// The compiler throws an error if the function is provided an `submode` option which is not an array of strings...
139
144
{
140
145
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
146
+
141
147
array ( buffer , { 'submode' : 'abc' } ) ; // $ExpectError
142
148
array ( buffer , { 'submode' : 123 } ) ; // $ExpectError
143
149
array ( buffer , { 'submode' : true } ) ; // $ExpectError
@@ -158,6 +164,7 @@ import array = require( './index' );
158
164
// The compiler throws an error if the function is provided a `copy` option which is not a boolean...
159
165
{
160
166
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
167
+
161
168
array ( buffer , { 'copy' : 'abc' } ) ; // $ExpectError
162
169
array ( buffer , { 'copy' : 123 } ) ; // $ExpectError
163
170
array ( buffer , { 'copy' : null } ) ; // $ExpectError
@@ -176,6 +183,7 @@ import array = require( './index' );
176
183
// The compiler throws an error if the function is provided a `flatten` option which is not a boolean...
177
184
{
178
185
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
186
+
179
187
array ( buffer , { 'flatten' : 'abc' } ) ; // $ExpectError
180
188
array ( buffer , { 'flatten' : 123 } ) ; // $ExpectError
181
189
array ( buffer , { 'flatten' : null } ) ; // $ExpectError
@@ -194,6 +202,7 @@ import array = require( './index' );
194
202
// The compiler throws an error if the function is provided a `ndmin` option which is not a number...
195
203
{
196
204
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
205
+
197
206
array ( buffer , { 'ndmin' : 'abc' } ) ; // $ExpectError
198
207
array ( buffer , { 'ndmin' : false } ) ; // $ExpectError
199
208
array ( buffer , { 'ndmin' : true } ) ; // $ExpectError
@@ -214,6 +223,7 @@ import array = require( './index' );
214
223
// The compiler throws an error if the function is provided a `casting` option which is not a string...
215
224
{
216
225
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
226
+
217
227
array ( buffer , { 'casting' : 123 } ) ; // $ExpectError
218
228
array ( buffer , { 'casting' : false } ) ; // $ExpectError
219
229
array ( buffer , { 'casting' : true } ) ; // $ExpectError
@@ -234,6 +244,7 @@ import array = require( './index' );
234
244
// The compiler throws an error if the function is provided a `readonly` option which is not a boolean...
235
245
{
236
246
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
247
+
237
248
array ( buffer , { 'readonly' : 'abc' } ) ; // $ExpectError
238
249
array ( buffer , { 'readonly' : 123 } ) ; // $ExpectError
239
250
array ( buffer , { 'readonly' : null } ) ; // $ExpectError
@@ -252,6 +263,7 @@ import array = require( './index' );
252
263
// The compiler throws an error if the function is provided an invalid number of arguments...
253
264
{
254
265
const buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 ] ) ;
266
+
255
267
array ( ) ; // $ExpectError
256
268
array ( buffer , { } , { } ) ; // $ExpectError
257
269
}
0 commit comments