Skip to content

Commit 5b7e803

Browse files
authored
Add type t to Stdlib modules (#7302)
* add a type t as an alias of the built-in types
1 parent d1c9aef commit 5b7e803

17 files changed

+60
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
- Allow single newline in JSX. https://github.com/rescript-lang/rescript/pull/7269
2222
- Editor: Always complete from Core first. Use actual native regex syntax in code snippets for regexps. https://github.com/rescript-lang/rescript/pull/7295
23+
- Add `type t` to Stdlib modules. https://github.com/rescript-lang/rescript/pull/7302
2324

2425
#### :bug: Bug fix
2526

runtime/Stdlib_Array.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
type t<'a> = array<'a>
12
type arrayLike<'a>
23

34
@new external makeUninitializedUnsafe: int => array<'a> = "Array"

runtime/Stdlib_Array.resi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/***
2+
A mutable array.
3+
4+
Compiles to a regular JavaScript array.*/
5+
6+
/**
7+
Type representing an array of value `'a`.
8+
*/
9+
type t<'a> = array<'a>
10+
111
type arrayLike<'a>
212

313
/**

runtime/Stdlib_BigInt.res

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
Type representing a bigint.
3+
*/
4+
type t = bigint
5+
16
@val external asIntN: (~width: int, bigint) => bigint = "BigInt.asIntN"
27
@val external asUintN: (~width: int, bigint) => bigint = "BigInt.asUintN"
38

runtime/Stdlib_Float.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
type t = float
2+
13
module Constants = {
24
@val external nan: float = "NaN"
35
@val external epsilon: float = "Number.EPSILON"

runtime/Stdlib_Float.resi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
Functions for interacting with float.
2727
*/
2828

29+
/**
30+
Type representing a float.
31+
*/
32+
type t = float
33+
2934
/**
3035
Float constants.
3136
*/

runtime/Stdlib_Int.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
type t = int
2+
13
module Constants = {
24
@inline let minValue = -2147483648
35
@inline let maxValue = 2147483647

runtime/Stdlib_Int.resi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ Functions for interacting with JavaScript Number.
2727
See: [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number).
2828
*/
2929

30+
/**
31+
Type representing an int.
32+
*/
33+
type t = int
34+
3035
module Constants: {
3136
/**
3237
The smallest positive number represented in JavaScript.

runtime/Stdlib_List.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161

6262
@@config({flags: ["-bs-noassertfalse"]})
6363

64+
type t<'a> = list<'a>
65+
6466
module A = {
6567
@new external makeUninitializedUnsafe: int => array<'a> = "Array"
6668
external min: ('a, 'a) => 'a = "%bs_min"

runtime/Stdlib_List.resi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Collection functions for manipulating the `list` data structures, a singly-linke
3131
- Better interop with JavaScript
3232
- Better memory usage & performance.
3333
*/
34+
/**
35+
Type representing a list of value `'a`.
36+
*/
37+
type t<'a> = list<'a>
38+
3439
/**
3540
`length(list)` returns the length of `list`.
3641

0 commit comments

Comments
 (0)