Skip to content

Commit 84516fd

Browse files
committed
Add Typescript definitions
1 parent 6a793a9 commit 84516fd

File tree

12 files changed

+319
-0
lines changed

12 files changed

+319
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2021 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Returns a list of ndarray casting modes.
23+
*
24+
* ## Notes
25+
*
26+
* - The output array contains the following modes:
27+
*
28+
* - 'none': only allow casting between identical types
29+
* - 'equiv': allow casting between identical and byte swapped types
30+
* - 'safe': only allow "safe" casts
31+
* - 'same-kind': allow "safe" casts and casts within the same kind (e.g.,
32+
* between signed integers or between floats)
33+
* - 'unsafe': allow casting between all types (including between integers and
34+
* floats)
35+
*
36+
* @returns list of ndarray casting modes
37+
*
38+
* @example
39+
* var list = modes();
40+
* // returns [ 'none', 'equiv', 'safe', 'same-kind', 'unsafe' ]
41+
*/
42+
declare function modes(): Array<string>;
43+
44+
45+
// EXPORTS //
46+
47+
export = modes;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2021 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import modes = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns an array of strings...
25+
{
26+
modes(); // $ExpectType string[]
27+
}
28+
29+
// The function does not compile if provided any arguments...
30+
{
31+
modes( 9 ); // $ExpectError
32+
}

lib/node_modules/@stdlib/ndarray/casting-modes/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": "./lib",
2222
"test": "./test"
2323
},
24+
"types": "./docs/types",
2425
"scripts": {},
2526
"homepage": "https://github.com/stdlib-js/stdlib",
2627
"repository": {
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2021 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Returns a list of ndarray data types.
23+
*
24+
* ## Notes
25+
*
26+
* - The output array contains the following data types:
27+
*
28+
* - binary: binary.
29+
* - float32: single-precision floating-point numbers.
30+
* - float64: double-precision floating-point numbers.
31+
* - generic: values of any type.
32+
* - int16: signed 16-bit integers.
33+
* - int32: signed 32-bit integers.
34+
* - int8: signed 8-bit integers.
35+
* - uint16: unsigned 16-bit integers.
36+
* - uint32: unsigned 32-bit integers.
37+
* - uint8: unsigned 8-bit integers.
38+
* - uint8c: unsigned clamped 8-bit integers.
39+
*
40+
* @returns list of ndarray data types
41+
*
42+
* @example
43+
* var list = dtypes();
44+
* // returns [...]
45+
*/
46+
declare function dtypes(): Array<string>;
47+
48+
49+
// EXPORTS //
50+
51+
export = dtypes;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2021 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import dtypes = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns an array of strings...
25+
{
26+
dtypes(); // $ExpectType string[]
27+
}
28+
29+
// The function does not compile if provided any arguments...
30+
{
31+
dtypes( 9 ); // $ExpectError
32+
}

lib/node_modules/@stdlib/ndarray/dtypes/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"lib": "./lib",
2323
"test": "./test"
2424
},
25+
"types": "./docs/types",
2526
"scripts": {},
2627
"homepage": "https://github.com/stdlib-js/stdlib",
2728
"repository": {
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2021 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Returns a list of ndarray index modes.
23+
*
24+
* ## Notes
25+
*
26+
* - The output array contains the following modes:
27+
*
28+
* - throw: specifies that a function should throw an error when an index is
29+
* outside a restricted interval.
30+
* - wrap: specifies that a function should wrap around an index using modulo
31+
* arithmetic.
32+
* - clamp: specifies that a function should set an index less than zero to
33+
* zero (minimum index) and set an index greater than a maximum index value to
34+
* the maximum possible index.
35+
*
36+
* @returns list of ndarray index modes
37+
*
38+
* @example
39+
* var list = modes();
40+
* // returns [ 'throw', 'clamp', 'wrap' ]
41+
*/
42+
declare function modes(): Array<string>;
43+
44+
45+
// EXPORTS //
46+
47+
export = modes;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2021 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import modes = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns an array of strings...
25+
{
26+
modes(); // $ExpectType string[]
27+
}
28+
29+
// The function does not compile if provided any arguments...
30+
{
31+
modes( 9 ); // $ExpectError
32+
}

lib/node_modules/@stdlib/ndarray/index-modes/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": "./lib",
2222
"test": "./test"
2323
},
24+
"types": "./docs/types",
2425
"scripts": {},
2526
"homepage": "https://github.com/stdlib-js/stdlib",
2627
"repository": {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2021 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Returns a list of ndarray orders.
23+
*
24+
* ## Notes
25+
*
26+
* - The output array contains the following orders:
27+
*
28+
* - row-major: row-major (C-style) order.
29+
* - column-major: column-major (Fortran-style) order.
30+
*
31+
* @returns list of ndarray orders
32+
*
33+
* @example
34+
* var list = orders();
35+
* // returns [ 'row-major', 'column-major' ]
36+
*/
37+
declare function orders(): Array<string>;
38+
39+
40+
// EXPORTS //
41+
42+
export = orders;

0 commit comments

Comments
 (0)