diff --git a/lib/node_modules/@stdlib/ndarray/array/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/array/docs/types/index.d.ts index 84fb7eff2c41..8b9ea382c4e6 100644 --- a/lib/node_modules/@stdlib/ndarray/array/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/array/docs/types/index.d.ts @@ -45,7 +45,7 @@ interface Options { /** * Specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw']). */ - submode?: Array; + submode?: Array; /** * Boolean indicating whether to copy source data to a new data buffer (default: false). @@ -76,7 +76,7 @@ interface Options { /** * Interface describing function options. */ -interface OptionsWithShape extends Options { +interface OptionsWithShape extends Options { /** * Array shape. */ @@ -89,13 +89,13 @@ interface OptionsWithShape extends Options { * * - If provided along with a `buffer` argument, the argument takes precedence. */ - buffer?: ArrayLike; + buffer?: ArrayLike; } /** * Interface describing function options. */ -interface OptionsWithBuffer extends Options { +interface OptionsWithBuffer extends Options { /** * Array shape. */ @@ -108,13 +108,13 @@ interface OptionsWithBuffer extends Options { * * - If provided along with a `buffer` argument, the argument takes precedence. */ - buffer: ArrayLike; + buffer: ArrayLike; } /** * Interface describing function options. */ -interface ExtendedOptions extends Options { +interface ExtendedOptions extends Options { /** * Array shape. */ @@ -127,7 +127,7 @@ interface ExtendedOptions extends Options { * * - If provided along with a `buffer` argument, the argument takes precedence. */ - buffer?: ArrayLike; + buffer?: ArrayLike; } /** @@ -164,7 +164,11 @@ interface ExtendedOptions extends Options { * var v = arr.get( 0 ); * // returns [ 1, 2 ] */ -declare function array( options: OptionsWithShape | OptionsWithBuffer ): typedndarray; + +type OptionsType = OptionsWithShape | OptionsWithBuffer; +declare function array( options: OptionsWithShape | OptionsWithBuffer ): typedndarray extends { dtype: infer D } ? D : never ) + : ( OptionsType extends { dtype: infer D } ? D : T )>; /** * Returns a multidimensional array. @@ -220,7 +224,7 @@ declare function array( options: OptionsWithShape | OptionsWithBuff * var v = arr.get( 0, 0 ); * // returns 1.0 */ -declare function array( buffer: ArrayLike, options?: ExtendedOptions ): typedndarray; +declare function array( buffer: ArrayLike, options?: ExtendedOptions ): typedndarray; // EXPORTS // diff --git a/lib/node_modules/@stdlib/ndarray/array/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/array/docs/types/test.ts index b58b3d7cbaf9..d1559720ef96 100644 --- a/lib/node_modules/@stdlib/ndarray/array/docs/types/test.ts +++ b/lib/node_modules/@stdlib/ndarray/array/docs/types/test.ts @@ -23,10 +23,10 @@ import array = require( './index' ); // The function returns an ndarray... { - array( [ [ 1, 2 ], [ 3, 4 ] ] ); // $ExpectType typedndarray + array>( [ [ 1, 2 ], [ 3, 4 ] ] ); // $ExpectType typedndarray array( new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ), { 'shape': [ 2, 2 ] } ); // $ExpectType typedndarray array( { 'shape': [ 2, 2 ] } ); // $ExpectType typedndarray - array( { 'buffer': [ [ 1, 2 ], [ 3, 4 ] ] } ); // $ExpectType typedndarray + array>( { 'buffer': [ [ 1, 2 ], [ 3, 4 ] ] } ); // $ExpectType typedndarray } // The compiler throws an error if the function is provided a first argument which is not an array, buffer, or options object...