Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: lint error
  • Loading branch information
headlessNode committed May 7, 2026
commit 9e6521b7ad9ce91c712a2258b6e979cb8faae390
43 changes: 31 additions & 12 deletions lib/node_modules/@stdlib/array/base/to-filled-by/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import Complex128Array = require( '@stdlib/array/complex128' );
import Complex64Array = require( '@stdlib/array/complex64' );
import BooleanArray = require( '@stdlib/array/bool' );
import Complex128 = require( '@stdlib/complex/float64/ctor' );
import toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
import toFilledBy = require( './index' );

Expand All @@ -34,6 +35,24 @@ function fcn<T>( value: T ): T {
return value;
}

/**
* Callback function returning a number.
*
* @returns fill value
*/
function clbk(): number {
return 5;
}

/**
* Callback function returning a complex number.
*
* @returns fill value
*/
function complexClbk(): Complex128 {
return new Complex128( 5.0, 5.0 );
}


// TESTS //

Expand Down Expand Up @@ -128,18 +147,18 @@ function fcn<T>( value: T ): T {
const x = [ 1, 2, 3, 4 ];
const y = new Complex128Array( 4 );

toFilledBy.assign( x, 1, 3, fcn, [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[]
toFilledBy.assign( x, 1, 3, fcn, new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array
toFilledBy.assign( x, 1, 3, fcn, new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array
toFilledBy.assign( x, 1, 3, fcn, new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array
toFilledBy.assign( x, 1, 3, fcn, new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array
toFilledBy.assign( x, 1, 3, fcn, new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array
toFilledBy.assign( x, 1, 3, fcn, new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array
toFilledBy.assign( x, 1, 3, fcn, new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array
toFilledBy.assign( x, 1, 3, fcn, new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array
toFilledBy.assign( x, 1, 3, fcn, new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray
toFilledBy.assign( y, 0, 1, fcn, new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array
toFilledBy.assign( y, 0, 1, fcn, new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array
toFilledBy.assign( x, 1, 3, clbk, [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[]
toFilledBy.assign( x, 1, 3, clbk, new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array
toFilledBy.assign( x, 1, 3, clbk, new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array
toFilledBy.assign( x, 1, 3, clbk, new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array
toFilledBy.assign( x, 1, 3, clbk, new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array
toFilledBy.assign( x, 1, 3, clbk, new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array
toFilledBy.assign( x, 1, 3, clbk, new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array
toFilledBy.assign( x, 1, 3, clbk, new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array
toFilledBy.assign( x, 1, 3, clbk, new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array
toFilledBy.assign( x, 1, 3, clbk, new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray
toFilledBy.assign( y, 0, 1, complexClbk, new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array
toFilledBy.assign( y, 0, 1, complexClbk, new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array
}

// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object...
Expand Down
Loading