Skip to content

Commit dd05593

Browse files
committed
Auto-generated commit
1 parent c7220b0 commit dd05593

File tree

3 files changed

+5
-30
lines changed

3 files changed

+5
-30
lines changed

base/flag/docs/types/index.d.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020

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

23-
import { ndarray } from '@stdlib/types/ndarray';
24-
25-
/**
26-
* Flag name.
27-
*/
28-
type Flag = string | symbol | number;
23+
import { ndarray, Flags } from '@stdlib/types/ndarray';
2924

3025
/**
3126
* Returns a specified flag for a provided ndarray.
@@ -40,7 +35,7 @@ type Flag = string | symbol | number;
4035
* var o = flag( zeros( [ 3, 3, 3 ] ), 'READONLY' );
4136
* // returns <boolean>
4237
*/
43-
declare function flag<T = unknown>( x: ndarray, name: Flag ): T;
38+
declare function flag<V extends keyof Flags>( x: ndarray, name: V ): Flags[V];
4439

4540

4641
// EXPORTS //

base/flag/docs/types/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import flag = require( './index' );
2424

2525
// The function returns an ndarray flag...
2626
{
27-
flag<boolean>( zeros( [ 3, 2, 1 ] ), 'READONLY' ); // $ExpectType boolean
27+
flag( zeros( [ 3, 2, 1 ] ), 'READONLY' ); // $ExpectType boolean | undefined
2828
}
2929

3030
// The compiler throws an error if the function is provided a first argument which is not an ndarray...

base/flags/docs/types/index.d.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,7 @@
2020

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

23-
import { ndarray } from '@stdlib/types/ndarray';
24-
25-
/**
26-
* Flags and other meta information (e.g., memory layout of the array).
27-
*/
28-
interface Flags {
29-
/**
30-
* Boolean indicating if an array is row-major contiguous.
31-
*/
32-
ROW_MAJOR_CONTIGUOUS?: boolean;
33-
34-
/**
35-
* Boolean indicating if an array is column-major contiguous.
36-
*/
37-
COLUMN_MAJOR_CONTIGUOUS?: boolean;
38-
39-
/**
40-
* Boolean indicating if an array is read-only.
41-
*/
42-
READONLY?: boolean;
43-
}
23+
import { ndarray, Flags } from '@stdlib/types/ndarray';
4424

4525
/**
4626
* Returns the flags of a provided ndarray.
@@ -59,7 +39,7 @@ interface Flags {
5939
* var o = flags( zeros( [ 3, 3, 3 ] ), false );
6040
* // returns {...}
6141
*/
62-
declare function flags( x: ndarray, copy: boolean ): Flags;
42+
declare function flags<T = unknown>( x: ndarray, copy: boolean ): Flags<T>;
6343

6444

6545
// EXPORTS //

0 commit comments

Comments
 (0)