Skip to content

Commit 3c6b016

Browse files
committed
refactor: improve type specificity
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent 2bc2d8b commit 3c6b016

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

lib/node_modules/@stdlib/ndarray/base/remove-singleton-dimensions/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { ndarray } from '@stdlib/types/ndarray';
4444
* var y = removeSingletonDimensions( x, false );
4545
* // returns <ndarray>[ [ 1, 2 ], [ 3, 4 ] ]
4646
*/
47-
declare function removeSingletonDimensions( x: ndarray, writable: boolean ): ndarray;
47+
declare function removeSingletonDimensions<T extends ndarray = ndarray>( x: T, writable: boolean ): T;
4848

4949

5050
// EXPORTS //

lib/node_modules/@stdlib/ndarray/base/remove-singleton-dimensions/docs/types/test.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@
1616
* limitations under the License.
1717
*/
1818

19-
import array = require( '@stdlib/ndarray/array' );
19+
/* eslint-disable space-in-parens */
20+
21+
import zeros = require( '@stdlib/ndarray/zeros' );
2022
import removeSingletonDimensions = require( './index' );
2123

2224

2325
// TESTS //
2426

2527
// The function returns an ndarray...
2628
{
27-
const x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
29+
const x = zeros( [ 2, 2 ], {
30+
'dtype': 'float64'
31+
});
2832

29-
removeSingletonDimensions( x, false ); // $ExpectType ndarray
33+
removeSingletonDimensions( x, false ); // $ExpectType float64ndarray
3034
}
3135

3236
// The compiler throws an error if the function is not provided a first argument which is an ndarray...
@@ -43,7 +47,9 @@ import removeSingletonDimensions = require( './index' );
4347

4448
// The compiler throws an error if the function is not provided a second argument which is a boolean...
4549
{
46-
const x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
50+
const x = zeros( [ 2, 2 ], {
51+
'dtype': 'float64'
52+
});
4753

4854
removeSingletonDimensions( x, '5' ); // $ExpectError
4955
removeSingletonDimensions( x, 5 ); // $ExpectError
@@ -55,7 +61,9 @@ import removeSingletonDimensions = require( './index' );
5561

5662
// The compiler throws an error if the function is provided an unsupported number of arguments...
5763
{
58-
const x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
64+
const x = zeros( [ 2, 2 ], {
65+
'dtype': 'float64'
66+
});
5967

6068
removeSingletonDimensions(); // $ExpectError
6169
removeSingletonDimensions( x ); // $ExpectError

lib/node_modules/@stdlib/ndarray/base/remove-singleton-dimensions/test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ tape( 'the function removes singleton dimensions (base)', function test( t ) {
160160
y = removeSingletonDimensions( x, false );
161161

162162
t.notEqual( y, x, 'returns expected value' );
163-
t.deepEqual( y.shape, [ 2, 2 ], 'returns expected value' );
163+
t.deepEqual( getShape( y ), [ 2, 2 ], 'returns expected value' );
164164
t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
165165

166166
t.end();

0 commit comments

Comments
 (0)