File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
lib/node_modules/@stdlib/array/typed/docs/types Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 22
22
23
23
/// <reference types="@stdlib/types"/>
24
24
25
- import { RealOrComplexTypedArray , TypedDataTypeMap } from '@stdlib/types/array' ;
25
+ import { RealOrComplexTypedArray , TypedDataTypeMap , Collection } from '@stdlib/types/array' ;
26
+ import { Iterator } from '@stdlib/types/iter' ;
26
27
import ArrayBuffer = require( '@stdlib/array/buffer' ) ;
27
28
28
29
/**
@@ -100,7 +101,7 @@ declare function typedarray<T extends keyof TypedDataTypeMap = 'float64'>( typed
100
101
* var arr = typedarray( [ 5, -3 ], 'int32' );
101
102
* // returns <Int32Array>[ 5, -3 ]
102
103
*/
103
- declare function typedarray < T extends keyof TypedDataTypeMap = 'float64' > ( obj : ArrayLike < number > | Iterable < any > , dtype ?: T ) : TypedDataTypeMap [ T ] ;
104
+ declare function typedarray < T extends keyof TypedDataTypeMap = 'float64' > ( obj : Collection < unknown > | Iterator , dtype ?: T ) : TypedDataTypeMap [ T ] ;
104
105
105
106
/**
106
107
* Creates a typed array.
Original file line number Diff line number Diff line change 16
16
* limitations under the License.
17
17
*/
18
18
19
+ import array2iterator = require( '@stdlib/array/to-iterator' ) ;
20
+ import ArrayBuffer = require( '@stdlib/array/buffer' ) ;
19
21
import typedarray = require( './index' ) ;
20
22
21
23
22
24
// TESTS //
23
25
24
- // The function returns a typed array..
26
+ // The function returns a typed array...
25
27
{
26
28
typedarray ( ) ; // $ExpectType Float64Array
29
+ typedarray ( [ 1 , 2 , 3 ] ) ; // $ExpectType Float64Array
30
+ typedarray ( array2iterator ( [ 1 , 2 , 3 ] ) ) ; // $ExpectType Float64Array
31
+ typedarray ( new ArrayBuffer ( 10 ) ) ; // $ExpectType Float64Array
32
+
27
33
typedarray ( 'float32' ) ; // $ExpectType Float32Array
28
34
typedarray ( 10 , 'float32' ) ; // $ExpectType Float32Array
29
35
typedarray ( [ 1 , 2 , 3 ] , 'int32' ) ; // $ExpectType Int32Array
You can’t perform that action at this time.
0 commit comments