diff --git a/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts b/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts index 7f4759e23f87..d03dcf1cbf59 100644 --- a/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts +++ b/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts @@ -26,6 +26,25 @@ import CircularBuffer = require( './index' ); // The function returns a circular buffer instance... { new CircularBuffer( 3 ); // $ExpectType CircularBuffer + new CircularBuffer( [2, 3] ); // $ExpectType CircularBuffer +} + +// The functions or fields of instance should be ok +{ + const buf = new CircularBuffer( 3 ); // $ExpectType CircularBuffer + buf.push( 'foo' ); + let circularBuf: CircularBuffer; + let numberType: number; + let booleanType: boolean; + let stringType: string; + let arrayType: any[]; + + numberType = buf.count; + numberType = buf.length; + booleanType = buf.full; + circularBuf = buf.clear(); + stringType = buf.toJSON(); + arrayType = buf.toArray(); } // The compiler throws an error if the constructor function is provided an invalid number of arguments... @@ -33,3 +52,14 @@ import CircularBuffer = require( './index' ); new CircularBuffer(); // $ExpectError new CircularBuffer( 3, 4 ); // $ExpectError } + +// The compiler throws an error if the constructor is provided an invalid argument type... +{ + new CircularBuffer( 'invalidType' ); // $ExpectError + new CircularBuffer( 12.2 ); // $ExpectError + new CircularBuffer( {} ); // $ExpectError + new CircularBuffer( true ); // $ExpectError + new CircularBuffer( null ); // $ExpectError + new CircularBuffer( undefined ); // $ExpectError + new CircularBuffer( new Date() ); // $ExpectError +}