Skip to content

Commit bf00a42

Browse files
committed
test: add ArrayIndex constructor tests
1 parent 415d506 commit bf00a42

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/array/to-fancy/docs/types

lib/node_modules/@stdlib/array/to-fancy/docs/types/test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,23 @@ import array2fancy = require( './index' );
161161
{
162162
array2fancy.factory( {}, {} ); // $ExpectError
163163
}
164+
165+
// Attached to the function is an `idx` method which returns an array index...
166+
{
167+
const x = [ 1, 2, 3, 4 ];
168+
const y = [ true, false, true, false ];
169+
const z = new Uint8Array( [ 1, 0, 1, 0 ] );
170+
const w = new Int32Array( [ 1, 2, 3, 4 ] );
171+
172+
array2fancy.idx( x ); // $ExpectType IntegerArrayIndex
173+
array2fancy.idx( x, {} ); // $ExpectType IntegerArrayIndex
174+
175+
array2fancy.idx( y ); // $ExpectType BooleanArrayIndex
176+
array2fancy.idx( y, {} ); // $ExpectType BooleanArrayIndex
177+
178+
array2fancy.idx( z ); // $ExpectType MaskArrayIndex
179+
array2fancy.idx( z, {} ); // $ExpectType MaskArrayIndex
180+
181+
array2fancy.idx( w ); // $ExpectType Int32ArrayIndex
182+
array2fancy.idx( w, {} ); // $ExpectType Int32ArrayIndex
183+
}

0 commit comments

Comments
 (0)