Skip to content

Commit b7a7039

Browse files
committed
Add overloads
1 parent c66c8b3 commit b7a7039

2 files changed

Lines changed: 108 additions & 4 deletions

File tree

lib/node_modules/@stdlib/array/ctors/docs/types/index.d.ts

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Complex64Array = require( '@stdlib/array/complex64' );
2525
* Returns a `Float64Array` constructor.
2626
*
2727
* @param dtype - data type
28-
* @returns constructor or null
28+
* @returns constructor
2929
*
3030
* @example
3131
* var ctor = ctors( 'float64' );
@@ -37,7 +37,7 @@ declare function ctors( dtype: 'float64' ): typeof Float64Array;
3737
* Returns a `Float32Array` constructor.
3838
*
3939
* @param dtype - data type
40-
* @returns constructor or null
40+
* @returns constructor
4141
*
4242
* @example
4343
* var ctor = ctors( 'float32' );
@@ -49,7 +49,7 @@ declare function ctors( dtype: 'float32' ): typeof Float32Array;
4949
* Returns a `Complex128Array` constructor.
5050
*
5151
* @param dtype - data type
52-
* @returns constructor or null
52+
* @returns constructor
5353
*
5454
* @example
5555
* var ctor = ctors( 'complex128' );
@@ -61,14 +61,110 @@ declare function ctors( dtype: 'complex128' ): typeof Complex128Array;
6161
* Returns a `Complex64Array` constructor.
6262
*
6363
* @param dtype - data type
64-
* @returns constructor or null
64+
* @returns constructor
6565
*
6666
* @example
6767
* var ctor = ctors( 'complex64' );
6868
* // returns <Function>
6969
*/
7070
declare function ctors( dtype: 'complex64' ): typeof Complex64Array;
7171

72+
/**
73+
* Returns an `Int32Array` constructor.
74+
*
75+
* @param dtype - data type
76+
* @returns constructor
77+
*
78+
* @example
79+
* var ctor = ctors( 'int32' );
80+
* // returns <Function>
81+
*/
82+
declare function ctors( dtype: 'int32' ): typeof Int32Array;
83+
84+
/**
85+
* Returns an `Int16Array` constructor.
86+
*
87+
* @param dtype - data type
88+
* @returns constructor
89+
*
90+
* @example
91+
* var ctor = ctors( 'int16' );
92+
* // returns <Function>
93+
*/
94+
declare function ctors( dtype: 'int16' ): typeof Int16Array;
95+
96+
/**
97+
* Returns an `Int8Array` constructor.
98+
*
99+
* @param dtype - data type
100+
* @returns constructor
101+
*
102+
* @example
103+
* var ctor = ctors( 'int8' );
104+
* // returns <Function>
105+
*/
106+
declare function ctors( dtype: 'int8' ): typeof Int8Array;
107+
108+
/**
109+
* Returns a `Uint32Array` constructor.
110+
*
111+
* @param dtype - data type
112+
* @returns constructor
113+
*
114+
* @example
115+
* var ctor = ctors( 'uint32' );
116+
* // returns <Function>
117+
*/
118+
declare function ctors( dtype: 'uint32' ): typeof Uint32Array;
119+
120+
/**
121+
* Returns a `Uint16Array` constructor.
122+
*
123+
* @param dtype - data type
124+
* @returns constructor
125+
*
126+
* @example
127+
* var ctor = ctors( 'uint16' );
128+
* // returns <Function>
129+
*/
130+
declare function ctors( dtype: 'uint16' ): typeof Uint16Array;
131+
132+
/**
133+
* Returns a `Uint8Array` constructor.
134+
*
135+
* @param dtype - data type
136+
* @returns constructor
137+
*
138+
* @example
139+
* var ctor = ctors( 'uint8' );
140+
* // returns <Function>
141+
*/
142+
declare function ctors( dtype: 'uint8' ): typeof Uint8Array;
143+
144+
/**
145+
* Returns a `Uint8ClampedArray` constructor.
146+
*
147+
* @param dtype - data type
148+
* @returns constructor
149+
*
150+
* @example
151+
* var ctor = ctors( 'uint8c' );
152+
* // returns <Function>
153+
*/
154+
declare function ctors( dtype: 'uint8c' ): typeof Uint8ClampedArray;
155+
156+
/**
157+
* Returns a generic array constructor.
158+
*
159+
* @param dtype - data type
160+
* @returns constructor
161+
*
162+
* @example
163+
* var ctor = ctors( 'generic' );
164+
* // returns <Function>
165+
*/
166+
declare function ctors( dtype: 'generic' ): typeof Array;
167+
72168
/**
73169
* Returns an array constructor.
74170
*

lib/node_modules/@stdlib/array/ctors/docs/types/test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ import ctors = require( './index' );
2727
ctors( 'float32' ); // $ExpectType Float32ArrayConstructor
2828
ctors( 'complex128' ); // $ExpectType Complex128ArrayConstructor
2929
ctors( 'complex64' ); // $ExpectType Complex64ArrayConstructor
30+
ctors( 'int32' ); // $ExpectType Int32ArrayConstructor
31+
ctors( 'int16' ); // $ExpectType Int16ArrayConstructor
32+
ctors( 'int8' ); // $ExpectType Int8ArrayConstructor
33+
ctors( 'uint32' ); // $ExpectType Uint32ArrayConstructor
34+
ctors( 'uint16' ); // $ExpectType Uint16ArrayConstructor
35+
ctors( 'uint8' ); // $ExpectType Uint8ArrayConstructor
36+
ctors( 'uint8c' ); // $ExpectType Uint8ClampedArrayConstructor
37+
ctors( 'generic' ); // $ExpectType ArrayConstructor
3038
ctors( 'float' ); // $ExpectType Function | null
3139
}
3240

0 commit comments

Comments
 (0)