Skip to content

Commit 3af398c

Browse files
committed
feat: add MultiSlice interface
1 parent d627bb1 commit 3af398c

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

lib/node_modules/@stdlib/types/index.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,6 +2886,8 @@ declare module '@stdlib/types/utilities' {
28862886
* const s: slice.Slice = { 'start': 0, 'stop': 10, 'step': 1 };
28872887
*/
28882888
declare module '@stdlib/types/slice' {
2889+
import { ArrayLike } from '@stdlib/types/array';
2890+
28892891
/**
28902892
* A slice object.
28912893
*
@@ -2908,4 +2910,22 @@ declare module '@stdlib/types/slice' {
29082910
*/
29092911
step: V;
29102912
}
2913+
2914+
/**
2915+
* A multi-slice object.
2916+
*
2917+
* @example
2918+
* const s: MultiSlice = { 'ndims': 1, 'data': [ 10 ] };
2919+
*/
2920+
interface MultiSlice {
2921+
/**
2922+
* Number of slice dimensions.
2923+
*/
2924+
ndims: number;
2925+
2926+
/**
2927+
* Slice data.
2928+
*/
2929+
data: ArrayLike<Slice | number | null>;
2930+
}
29112931
}

lib/node_modules/@stdlib/types/test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,4 +666,12 @@ function cmplx128Array(): array.Complex128Array {
666666
if ( v6.start !== v6.start ) {
667667
throw new Error( 'something went wrong' );
668668
}
669+
670+
const v7: slice.MultiSlice = {
671+
'ndims': 3,
672+
'data': [ 1, null, 3 ]
673+
};
674+
if ( v7.ndims !== v7.ndims ) {
675+
throw new Error( 'something went wrong' );
676+
}
669677
}

0 commit comments

Comments
 (0)