File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 2121/// <reference types="@stdlib/types"/>
2222
2323import { Collection } from '@stdlib/types/array' ;
24+ import { Shape2D } from '@stdlib/types/ndarray' ;
25+
26+ /**
27+ * Two-dimensional nested array.
28+ */
29+ type Array2D < T > = Array < Array < T > > ;
2430
2531/**
2632* Returns a zero-filled two-dimensional nested array.
@@ -32,7 +38,7 @@ import { Collection } from '@stdlib/types/array';
3238* var out = zeros2d( [ 1, 3 ] );
3339* // returns [ [ 0.0, 0.0, 0.0 ] ]
3440*/
35- declare function zeros2d ( shape : Collection < number > ) : Array < Array < number > > ;
41+ declare function zeros2d ( shape : Shape2D ) : Array2D < number > ;
3642
3743
3844// EXPORTS //
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import zeros2d = require( './index' );
2323
2424// The function returns an array of arrays...
2525{
26- zeros2d ( [ 1 , 3 ] ) ; // $ExpectType number[][]
26+ zeros2d ( [ 1 , 3 ] ) ; // $ExpectType Array2D< number>
2727}
2828
2929// The compiler throws an error if the function is provided a first argument which is not an array of numbers...
You can’t perform that action at this time.
0 commit comments