File tree 1 file changed +13
-0
lines changed
lib/node_modules/@stdlib/utils/circular-buffer/docs/types
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,23 @@ import CircularBuffer = require( './index' );
29
29
// The function returns a circular buffer instance...
30
30
{
31
31
new CircularBuffer ( 3 ) ; // $ExpectType CircularBuffer<unknown>
32
+ new CircularBuffer ( [ 1 , 2 , 3 ] ) ; // $ExpectType CircularBuffer<number>
33
+ new CircularBuffer ( 'abc' ) ; // $ExpectType CircularBuffer<string>
34
+ new CircularBuffer ( { 'length' : 10 } ) ; // $ExpectType CircularBuffer<unknown>
32
35
}
33
36
34
37
// The compiler throws an error if the constructor function is provided an invalid number of arguments...
35
38
{
36
39
new CircularBuffer ( ) ; // $ExpectError
37
40
new CircularBuffer ( 3 , 4 ) ; // $ExpectError
38
41
}
42
+
43
+ // The compiler throws an error if the constructor function is provided a first argument which is not a number or an array-like object...
44
+ {
45
+ new CircularBuffer ( true ) ; // $ExpectError
46
+ new CircularBuffer ( false ) ; // $ExpectError
47
+ new CircularBuffer ( null ) ; // $ExpectError
48
+ new CircularBuffer ( undefined ) ; // $ExpectError
49
+ new CircularBuffer ( { } ) ; // $ExpectError
50
+ new CircularBuffer ( ( x : number ) : number => x ) ; // $ExpectError
51
+ }
You can’t perform that action at this time.
0 commit comments