File tree Expand file tree Collapse file tree
lib/node_modules/@stdlib/array/to-fancy/docs/types Expand file tree Collapse file tree Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments