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 2222
2323/// <reference types="@stdlib/types"/>
2424
25- import { RealOrComplexTypedArray , TypedDataTypeMap } from '@stdlib/types/array' ;
25+ import { RealOrComplexTypedArray , TypedDataTypeMap , Collection } from '@stdlib/types/array' ;
26+ import { Iterator } from '@stdlib/types/iter' ;
2627import ArrayBuffer = require( '@stdlib/array/buffer' ) ;
2728
2829/**
@@ -100,7 +101,7 @@ declare function typedarray<T extends keyof TypedDataTypeMap = 'float64'>( typed
100101* var arr = typedarray( [ 5, -3 ], 'int32' );
101102* // returns <Int32Array>[ 5, -3 ]
102103*/
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 ] ;
104105
105106/**
106107* Creates a typed array.
Original file line number Diff line number Diff line change 1616* limitations under the License.
1717*/
1818
19+ import array2iterator = require( '@stdlib/array/to-iterator' ) ;
20+ import ArrayBuffer = require( '@stdlib/array/buffer' ) ;
1921import typedarray = require( './index' ) ;
2022
2123
2224// TESTS //
2325
24- // The function returns a typed array..
26+ // The function returns a typed array...
2527{
2628 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+
2733 typedarray ( 'float32' ) ; // $ExpectType Float32Array
2834 typedarray ( 10 , 'float32' ) ; // $ExpectType Float32Array
2935 typedarray ( [ 1 , 2 , 3 ] , 'int32' ) ; // $ExpectType Int32Array
You can’t perform that action at this time.
0 commit comments