Skip to content

Commit c968abb

Browse files
Jaysukh-409aman-095
authored andcommitted
feat: add boolean dtype support in array/next-dtype
PR-URL: stdlib-js#2362 Ref: stdlib-js#2304 Reviewed-by: Athan Reines <[email protected]>
1 parent 447d69a commit c968abb

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

lib/node_modules/@stdlib/array/next-dtype/docs/types/index.d.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2021 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -192,6 +192,22 @@ declare function nextDataType( dtype: 'uint8c' ): 'uint16'; // eslint-disable-li
192192
*/
193193
declare function nextDataType( dtype: 'generic' ): number; // eslint-disable-line @typescript-eslint/unified-signatures
194194

195+
/**
196+
* Returns the next larger array data type of the same kind.
197+
*
198+
* ## Notes
199+
*
200+
* - If a data type does not have a next larger data type or the next larger type is not supported, the function returns `-1`.
201+
*
202+
* @param dtype - array data type
203+
* @returns next larger data type
204+
*
205+
* @example
206+
* var dt = nextDataType( 'bool' );
207+
* // returns -1
208+
*/
209+
declare function nextDataType( dtype: 'bool' ): number; // eslint-disable-line @typescript-eslint/unified-signatures
210+
195211
/**
196212
* Returns the next larger array data type of the same kind.
197213
*

lib/node_modules/@stdlib/array/next-dtype/docs/types/test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2021 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -31,6 +31,8 @@ import nextDataType = require( './index' );
3131
nextDataType( 'complex128' ); // $ExpectType number
3232
nextDataType( 'complex64' ); // $ExpectType "complex128"
3333

34+
nextDataType( 'bool' ); // $ExpectType number
35+
3436
nextDataType( 'float64' ); // $ExpectType number
3537
nextDataType( 'float32' ); // $ExpectType "float64"
3638

lib/node_modules/@stdlib/array/next-dtype/lib/next_dtypes.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"uint8": "uint16",
1010
"uint8c": "uint16",
1111
"generic": -1,
12+
"bool": -1,
1213
"complex64": "complex128",
1314
"complex128": -1
1415
}

0 commit comments

Comments
 (0)