Skip to content

Commit

Permalink
refactor: revert back to original signature for generic collections
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Feb 19, 2024
1 parent 3c06d16 commit 7ab004b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
26 changes: 24 additions & 2 deletions lib/node_modules/@stdlib/array/base/slice/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/// <reference types="@stdlib/types"/>

import { Collection, ComplexTypedArray } from '@stdlib/types/array';
import { Collection, TypedArray, ComplexTypedArray } from '@stdlib/types/array';

/**
* Returns a shallow copy of a portion of an array.
Expand All @@ -46,7 +46,29 @@ import { Collection, ComplexTypedArray } from '@stdlib/types/array';
* var out = slice( x, 0, 3 );
* // returns <Complex64Array>[ 1.0, 2.0, 3.0 ]
*/
declare function slice<T extends Collection | ComplexTypedArray>( x: T, start: number, end: number ): T;
declare function slice<T extends TypedArray | ComplexTypedArray>( x: T, start: number, end: number ): T;

/**
* Returns a shallow copy of a portion of an array.
*
* @param x - input array
* @param start - starting index (inclusive)
* @param end - ending index (exclusive)
* @returns output array
*
* @example
* var x = [ 1, 2, 3 ];
*
* var out = slice( x, 0, 3 );
* // returns [ 1, 2, 3 ]
*
* @example
* var x = [ 1, 2, 3, 4, 5, 6 ];
*
* var out = slice( x, 0, 2 );
* // returns [ 1, 2 ]
*/
declare function slice<T = unknown>( x: Collection<T>, start: number, end: number ): Array<T>;


// EXPORTS //
Expand Down
28 changes: 25 additions & 3 deletions lib/node_modules/@stdlib/array/slice/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/// <reference types="@stdlib/types"/>

import { Collection, ComplexTypedArray } from '@stdlib/types/array';
import { Collection, TypedArray, ComplexTypedArray } from '@stdlib/types/array';

/**
* Returns a shallow copy of a portion of an array.
Expand All @@ -35,7 +35,7 @@ import { Collection, ComplexTypedArray } from '@stdlib/types/array';
*
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
*
* var out = slice( x )
* var out = slice( x );
* // returns <Float64Array>[ 1.0, 2.0, 3.0 ]
*
* @example
Expand All @@ -46,7 +46,29 @@ import { Collection, ComplexTypedArray } from '@stdlib/types/array';
* var out = slice( x );
* // returns <Complex64Array>[ 1.0, 2.0, 3.0 ]
*/
declare function slice<T extends Collection | ComplexTypedArray>( x: T, start?: number, end?: number ): T;
declare function slice<T extends TypedArray | ComplexTypedArray>( x: T, start?: number, end?: number ): T;

/**
* Returns a shallow copy of a portion of an array.
*
* @param x - input array
* @param start - starting index (inclusive)
* @param end - ending index (exclusive)
* @returns output array
*
* @example
* var x = [ 1, 2, 3 ];
*
* var out = slice( x );
* // returns [ 1, 2, 3 ]
*
* @example
* var x = [ 1, 2, 3, 4, 5, 6 ];
*
* var out = slice( x, 0, 2 );
* // returns [ 1, 2 ]
*/
declare function slice<T = unknown>( x: Collection<T>, start?: number, end?: number ): Array<T>;


// EXPORTS //
Expand Down

0 comments on commit 7ab004b

Please sign in to comment.