Skip to content
Draft
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
14 changes: 14 additions & 0 deletions lib/node_modules/@stdlib/array/dtype/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@
*/
declare function dtype( value: Float32Array ): 'float32';

/**
* Returns the data type of an array.
*
* @param value - input value
* @returns data type
*
* @example
* var Float16Array = require( '@stdlib/array/float16' );
*
* var dt = dtype( new Float16Array( [ 1, 2, 3 ] ) );
* // returns 'float16'
*/
declare function dtype( value: Float16Array ): 'float16';

/**
* Returns the data type of an array.
*
Expand Down Expand Up @@ -200,7 +214,7 @@
* var dt = dtype( [ 1, 2, 3 ] );
* // returns 'generic'
*/
declare function dtype( value: Array<any> ): 'generic';

Check warning on line 217 in lib/node_modules/@stdlib/array/dtype/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type

/**
* Returns the data type of an array.
Expand All @@ -219,7 +233,7 @@
* var dt = dtype( 'beep' );
* // returns null
*/
declare function dtype( value: Array<any> | RealOrComplexTypedArray ): DataType | null;

Check warning on line 236 in lib/node_modules/@stdlib/array/dtype/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type


// EXPORTS //
Expand Down
2 changes: 2 additions & 0 deletions lib/node_modules/@stdlib/array/dtype/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import Complex128Array = require( '@stdlib/array/complex128' );
import Complex64Array = require( '@stdlib/array/complex64' );
import BooleanArray = require( '@stdlib/array/bool' );
import Float16Array = require( '@stdlib/array/float16' );
import dtype = require( './index' );


Expand All @@ -28,16 +29,17 @@
{
dtype( new Float64Array( 10 ) ); // $ExpectType "float64"
dtype( new Float32Array( 10 ) ); // $ExpectType "float32"
dtype( new Float16Array( 10 ) ); // $ExpectType "float16"
dtype( new Complex128Array( 10 ) ); // $ExpectType "complex128"

Check failure on line 33 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "complex128", got: "float16"
dtype( new Complex64Array( 10 ) ); // $ExpectType "complex64"

Check failure on line 34 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "complex64", got: "float16"
dtype( new Int32Array( 10 ) ); // $ExpectType "int32"

Check failure on line 35 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "int32", got: "float16"
dtype( new Int16Array( 10 ) ); // $ExpectType "int16"

Check failure on line 36 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "int16", got: "float16"
dtype( new Int8Array( 10 ) ); // $ExpectType "int8"

Check failure on line 37 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "int8", got: "float16"
dtype( new Uint32Array( 10 ) ); // $ExpectType "uint32"

Check failure on line 38 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "uint32", got: "float16"
dtype( new Uint16Array( 10 ) ); // $ExpectType "uint16"

Check failure on line 39 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "uint16", got: "float16"
dtype( new Uint8Array( 10 ) ); // $ExpectType "uint8"

Check failure on line 40 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "uint8", got: "float16"
dtype( new Uint8ClampedArray( 10 ) ); // $ExpectType "uint8c"

Check failure on line 41 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "uint8c", got: "float16"
dtype( new BooleanArray( 10 ) ); // $ExpectType "bool"

Check failure on line 42 in lib/node_modules/@stdlib/array/dtype/docs/types/test.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Expected type to be: "bool", got: "float16"
dtype( [] ); // $ExpectType "generic"
}

Expand Down
1 change: 1 addition & 0 deletions lib/node_modules/@stdlib/array/dtype/lib/ctor2dtype.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

// Mapping from array constructors to data types...
var ctor2dtypes = {
'Float16Array': 'float16',
'Float32Array': 'float32',
'Float64Array': 'float64',
'Array': 'generic',
Expand Down
2 changes: 2 additions & 0 deletions lib/node_modules/@stdlib/array/dtype/lib/ctors.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

var Float64Array = require( '@stdlib/array/float64' );
var Float32Array = require( '@stdlib/array/float32' );
var Float16Array = require( '@stdlib/array/float16' );
var Uint32Array = require( '@stdlib/array/uint32' );
var Int32Array = require( '@stdlib/array/int32' );
var Uint16Array = require( '@stdlib/array/uint16' );
Expand All @@ -40,6 +41,7 @@ var BooleanArray = require( '@stdlib/array/bool' );
var CTORS = [
Float64Array,
Float32Array,
Float16Array,
Int32Array,
Uint32Array,
Int16Array,
Expand Down
1 change: 1 addition & 0 deletions lib/node_modules/@stdlib/array/dtype/lib/dtypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
var DTYPES = [
'float64',
'float32',
'float16',
'int32',
'uint32',
'int16',
Expand Down
Loading