Skip to content

Commit b16c66f

Browse files
authored
Add Js.globalThis object binding (rescript-lang#6909)
1 parent 29c03c5 commit b16c66f

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- Allow `private` in with constraints. https://github.com/rescript-lang/rescript-compiler/pull/6843
2424
- Add regex literals as syntax sugar for `@bs.re`. https://github.com/rescript-lang/rescript-compiler/pull/6776
2525
- Improved mechanism to determine arity of externals, which is consistent however the type is written. https://github.com/rescript-lang/rescript-compiler/pull/6874 https://github.com/rescript-lang/rescript-compiler/pull/6881 https://github.com/rescript-lang/rescript-compiler/pull/6883
26+
- Add `Js.globalThis` object binding. https://github.com/rescript-lang/rescript-compiler/pull/6909
2627

2728
#### :boom: Breaking Change
2829

jscomp/others/js.res

+3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ Prefer `Js.Array2` over `Js.Array`, `Js.String2` over `Js.String`, etc. The latt
7777
/** JS object type */
7878
type t<'a> = {..} as 'a
7979

80+
/** JS global object reference */
81+
@val external globalThis: t<'a> = "globalThis"
82+
8083
/**
8184
Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t.
8285
*/

jscomp/runtime/js.res

+3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ Prefer `Js.Array2` over `Js.Array`, `Js.String2` over `Js.String`, etc. The latt
7777
/** JS object type */
7878
type t<'a> = {..} as 'a
7979

80+
/** JS global object reference */
81+
@val external globalThis: t<'a> = "globalThis"
82+
8083
/**
8184
Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t.
8285
*/

0 commit comments

Comments
 (0)