Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion lib/node_modules/@stdlib/array/take/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/// <reference types="@stdlib/types"/>

import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array';
import { Collection, AccessorArrayLike, Float16Array, Complex128Array, Complex64Array } from '@stdlib/types/array';
import { Mode } from '@stdlib/types/ndarray';

/**
Expand Down Expand Up @@ -72,6 +72,23 @@ declare function take( x: Float64Array, indices: IndexArray, options?: Options )
*/
declare function take( x: Float32Array, indices: IndexArray, options?: Options ): Float32Array;

/**
* Takes elements from an array.
*
* @param x - input array
* @param indices - list of element indices
* @param options - function options
* @returns output array
*
* @example
* var Float16Array = require( '@stdlib/array/float16' );
*
* var x = new Float16Array( [ 1.0, 2.0, 3.0, 4.0 ] );
* var y = take( x, [ 1, 3 ] );
* // returns <Float16Array>[ 2.0, 4.0 ]
*/
declare function take( x: Float16Array, indices: IndexArray, options?: Options ): Float16Array;

/**
* Takes elements from an array.
*
Expand Down
2 changes: 2 additions & 0 deletions lib/node_modules/@stdlib/array/take/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* limitations under the License.
*/

import Float16Array = require( '@stdlib/array/float16' );
import Complex128Array = require( '@stdlib/array/complex128' );
import Complex64Array = require( '@stdlib/array/complex64' );
import take = require( './index' );
Expand All @@ -26,12 +27,13 @@
// The function returns an array...
{
take( [ 1, 2, 3, 4 ], [ 1, 3 ] ); // $ExpectType number[]
take<any>( [ 1, 2, 3, 4 ], [ 1, 3 ] ); // $ExpectType any[]

Check warning on line 30 in lib/node_modules/@stdlib/array/take/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type
take<number>( [ 1, 2, 3, 4 ], [ 1, 3 ] ); // $ExpectType number[]
take<string>( [ '1', '2', '3', '4' ], [ 1, 3 ] ); // $ExpectType string[]

take( new Float64Array( 10 ), [ 1, 3 ] ); // $ExpectType Float64Array
take( new Float32Array( 10 ), [ 1, 3 ] ); // $ExpectType Float32Array
take( new Float16Array( 10 ), [ 1, 3 ] ); // $ExpectType Float16ArrayFallback
take( new Int32Array( 10 ), [ 1, 3 ] ); // $ExpectType Int32Array
take( new Int16Array( 10 ), [ 1, 3 ] ); // $ExpectType Int16Array
take( new Int8Array( 10 ), [ 1, 3 ] ); // $ExpectType Int8Array
Expand Down