|
20 | 20 |
|
21 | 21 | /// <reference types="@stdlib/types"/>
|
22 | 22 |
|
23 |
| -import { AnyArray, Complex128Array, Complex64Array, DataType } from '@stdlib/types/array'; |
24 |
| -import { ComplexLike } from '@stdlib/types/complex'; |
25 |
| - |
26 |
| -/** |
27 |
| -* Creates a filled array having a specified length. |
28 |
| -* |
29 |
| -* @param length - array length |
30 |
| -* @param value - fill value |
31 |
| -* @param dtype - data type |
32 |
| -* @returns filled array |
33 |
| -* |
34 |
| -* @example |
35 |
| -* var arr = full( 2, 1.0, 'float64' ); |
36 |
| -* // returns <Float64Array>[ 1.0, 1.0 ] |
37 |
| -*/ |
38 |
| -declare function full( length: number, value: number, dtype: 'float64' ): Float64Array; |
39 |
| - |
40 |
| -/** |
41 |
| -* Creates a filled array having a specified length. |
42 |
| -* |
43 |
| -* @param length - array length |
44 |
| -* @param value - fill value |
45 |
| -* @param dtype - data type |
46 |
| -* @returns filled array |
47 |
| -* |
48 |
| -* @example |
49 |
| -* var arr = full( 2, 1.0, 'float32' ); |
50 |
| -* // returns <Float32Array>[ 1.0, 1.0 ] |
51 |
| -*/ |
52 |
| -declare function full( length: number, value: number, dtype: 'float32' ): Float32Array; |
53 |
| - |
54 |
| -/** |
55 |
| -* Creates a filled array having a specified length. |
56 |
| -* |
57 |
| -* @param length - array length |
58 |
| -* @param value - fill value |
59 |
| -* @param dtype - data type |
60 |
| -* @returns filled array |
61 |
| -* |
62 |
| -* @example |
63 |
| -* var Complex128 = require( '@stdlib/complex-float64' ); |
64 |
| -* |
65 |
| -* var arr = full( 2, new Complex128( 1.0, 2.0 ), 'complex128' ); |
66 |
| -* // returns <Complex128Array> |
67 |
| -*/ |
68 |
| -declare function full( length: number, value: ComplexLike, dtype: 'complex128' ): Complex128Array; |
69 |
| - |
70 |
| -/** |
71 |
| -* Creates a filled array having a specified length. |
72 |
| -* |
73 |
| -* @param length - array length |
74 |
| -* @param value - fill value |
75 |
| -* @param dtype - data type |
76 |
| -* @returns filled array |
77 |
| -* |
78 |
| -* @example |
79 |
| -* var Complex64 = require( '@stdlib/complex-float32' ); |
80 |
| -* |
81 |
| -* var arr = full( 2, new Complex64( 1.0, 2.0 ), 'complex64' ); |
82 |
| -* // returns <Complex64Array> |
83 |
| -*/ |
84 |
| -declare function full( length: number, value: ComplexLike, dtype: 'complex64' ): Complex64Array; |
85 |
| - |
86 |
| -/** |
87 |
| -* Creates a filled array having a specified length. |
88 |
| -* |
89 |
| -* @param length - array length |
90 |
| -* @param value - fill value |
91 |
| -* @param dtype - data type |
92 |
| -* @returns filled array |
93 |
| -* |
94 |
| -* @example |
95 |
| -* var arr = full( 2, 1, 'int32' ); |
96 |
| -* // returns <Int32Array>[ 1, 1 ] |
97 |
| -*/ |
98 |
| -declare function full( length: number, value: number, dtype: 'int32' ): Int32Array; |
99 |
| - |
100 |
| -/** |
101 |
| -* Creates a filled array having a specified length. |
102 |
| -* |
103 |
| -* @param length - array length |
104 |
| -* @param value - fill value |
105 |
| -* @param dtype - data type |
106 |
| -* @returns filled array |
107 |
| -* |
108 |
| -* @example |
109 |
| -* var arr = full( 2, 1, 'int16' ); |
110 |
| -* // returns <Int16Array>[ 1, 1 ] |
111 |
| -*/ |
112 |
| -declare function full( length: number, value: number, dtype: 'int16' ): Int16Array; |
113 |
| - |
114 |
| -/** |
115 |
| -* Creates a filled array having a specified length. |
116 |
| -* |
117 |
| -* @param length - array length |
118 |
| -* @param value - fill value |
119 |
| -* @param dtype - data type |
120 |
| -* @returns filled array |
121 |
| -* |
122 |
| -* @example |
123 |
| -* var arr = full( 2, 1, 'int8' ); |
124 |
| -* // returns <Int8Array>[ 1, 1 ] |
125 |
| -*/ |
126 |
| -declare function full( length: number, value: number, dtype: 'int8' ): Int8Array; |
127 |
| - |
128 |
| -/** |
129 |
| -* Creates a filled array having a specified length. |
130 |
| -* |
131 |
| -* @param length - array length |
132 |
| -* @param value - fill value |
133 |
| -* @param dtype - data type |
134 |
| -* @returns filled array |
135 |
| -* |
136 |
| -* @example |
137 |
| -* var arr = full( 2, 1, 'uint32' ); |
138 |
| -* // returns <Uint32Array>[ 1, 1 ] |
139 |
| -*/ |
140 |
| -declare function full( length: number, value: number, dtype: 'uint32' ): Uint32Array; |
141 |
| - |
142 |
| -/** |
143 |
| -* Creates a filled array having a specified length. |
144 |
| -* |
145 |
| -* @param length - array length |
146 |
| -* @param value - fill value |
147 |
| -* @param dtype - data type |
148 |
| -* @returns filled array |
149 |
| -* |
150 |
| -* @example |
151 |
| -* var arr = full( 2, 1, 'uint16' ); |
152 |
| -* // returns <Uint16Array>[ 1, 1 ] |
153 |
| -*/ |
154 |
| -declare function full( length: number, value: number, dtype: 'uint16' ): Uint16Array; |
155 |
| - |
156 |
| -/** |
157 |
| -* Creates a filled array having a specified length. |
158 |
| -* |
159 |
| -* @param length - array length |
160 |
| -* @param value - fill value |
161 |
| -* @param dtype - data type |
162 |
| -* @returns filled array |
163 |
| -* |
164 |
| -* @example |
165 |
| -* var arr = full( 2, 1, 'uint8' ); |
166 |
| -* // returns <Uint8Array>[ 1, 1 ] |
167 |
| -*/ |
168 |
| -declare function full( length: number, value: number, dtype: 'uint8' ): Uint8Array; |
169 |
| - |
170 |
| -/** |
171 |
| -* Creates a filled array having a specified length. |
172 |
| -* |
173 |
| -* @param length - array length |
174 |
| -* @param value - fill value |
175 |
| -* @param dtype - data type |
176 |
| -* @returns filled array |
177 |
| -* |
178 |
| -* @example |
179 |
| -* var arr = full( 2, 1, 'uint8c' ); |
180 |
| -* // returns <Uint8ClampedArray>[ 1, 1 ] |
<
F438
code>181 |
| -*/ |
182 |
| -declare function full( length: number, value: number, dtype: 'uint8c' ): Uint8ClampedArray; |
183 |
| - |
184 |
| -/** |
185 |
| -* Creates a filled array having a specified length. |
186 |
| -* |
187 |
| -* @param length - array length |
188 |
| -* @param value - fill value |
189 |
| -* @param dtype - data type |
190 |
| -* @returns filled array |
191 |
| -* |
192 |
| -* @example |
193 |
| -* var arr = full( 2, 1, 'generic' ); |
194 |
| -* // returns [ 1, 1 ] |
195 |
| -*/ |
196 |
| -declare function full( length: number, value: any, dtype: 'generic' ): Array<any>; |
| 23 | +import { DataTypeMap } from '@stdlib/types/array'; |
197 | 24 |
|
198 | 25 | /**
|
199 | 26 | * Creates a filled array having a specified length.
|
@@ -226,7 +53,7 @@ declare function full( length: number, value: any, dtype: 'generic' ): Array<any
|
226 | 53 | * var arr = full( 2, 1.0, 'float32' );
|
227 | 54 | * // returns <Float32Array>[ 1.0, 1.0 ]
|
228 | 55 | */
|
229 |
| -declare function full( length: number, value: any, dtype?: DataType ): AnyArray; |
| 56 | +declare function full<T, U extends keyof DataTypeMap<number> = 'float64'>( length: number, value: T, dtype?: U ): DataTypeMap<T>[U]; |
230 | 57 |
|
231 | 58 |
|
232 | 59 | // EXPORTS //
|
|
0 commit comments