Skip to content

Commit a587243

Browse files
cometkimcknitt
authored andcommitted
fix JSBigInt payload type (#6911)
1 parent baa8b9d commit a587243

File tree

9 files changed

+13
-21
lines changed

9 files changed

+13
-21
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- Ignore `@uncurry` attribute in uncurried mode, to avoid generating calls to `Curry` at runtime. https://github.com/rescript-lang/rescript-compiler/pull/6869
2121
- Avoid generating calls to Curry when adjusting arity of uncurried functions. https://github.com/rescript-lang/rescript-compiler/pull/6870
2222
- Fix build after calling without `-warn-error`, see https://github.com/rescript-lang/rescript-compiler/issues/6868 for more details. https://github.com/rescript-lang/rescript-compiler/pull/6877
23+
- Fix `Js.Types.JSBigInt` payload to use native `bigint` type. https://github.com/rescript-lang/rescript-compiler/pull/6911
2324

2425
# 11.1.3-rc.1
2526

jscomp/gentype_tests/typescript-react-example/src/BigInt.res

-1
This file was deleted.

jscomp/gentype_tests/typescript-react-example/src/BigInt.res.js

-2
This file was deleted.

jscomp/gentype_tests/typescript-react-example/src/Core.gen.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ export const date0: (x:Date) => Date = CoreJS.date0 as any;
5151

5252
export const date1: (x:Date) => Date = CoreJS.date1 as any;
5353

54-
export const bigint0: (x:BigInt) => BigInt = CoreJS.bigint0 as any;
55-
56-
export const bigint1: (x:BigInt) => BigInt = CoreJS.bigint1 as any;
54+
export const bigint0: (x:bigint) => bigint = CoreJS.bigint0 as any;
5755

5856
export const regexp0: (x:RegExp) => RegExp = CoreJS.regexp0 as any;
5957

jscomp/gentype_tests/typescript-react-example/src/Core.res

+1-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ let date0 = (x: Js.Date.t) => x
3535
let date1 = (x: Date.t) => x
3636

3737
@genType
38-
let bigint0 = (x: Js.Types.bigint_val) => x
39-
40-
@genType
41-
let bigint1 = (x: BigInt.t) => x
38+
let bigint0 = (x: bigint) => x
4239

4340
@genType
4441
let regexp0 = (x: Js.Re.t) => x

jscomp/others/js_types.res

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
/** Js symbol type only available in ES6 */
2626
type symbol
2727

28-
/** Js bigint type only available in ES2020 */
29-
type bigint_val = bigint
30-
3128
type obj_val
3229
/** This type has only one value `undefined` */
3330
type undefined_val
@@ -46,7 +43,7 @@ type rec t<_> =
4643
| Function: t<function_val>
4744
| Object: t<obj_val>
4845
| Symbol: t<symbol>
49-
| BigInt: t<bigint_val>
46+
| BigInt: t<bigint>
5047

5148
type tagged_t =
5249
| JSFalse
@@ -58,7 +55,7 @@ type tagged_t =
5855
| JSFunction(function_val)
5956
| JSObject(obj_val)
6057
| JSSymbol(symbol)
61-
| JSBigInt(bigint_val)
58+
| JSBigInt(bigint)
6259

6360
let classify = (x: 'a): tagged_t => {
6461
let ty = Js.typeof(x)

jscomp/others/js_types.resi

+2-5
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
/** Js symbol type (only available in ES6) */
2828
type symbol
2929

30-
/** Js bigint type only available in ES2020 */
31-
type bigint_val
32-
3330
type obj_val
3431

3532
/** This type has only one value `undefined` */
@@ -49,7 +46,7 @@ type rec t<_> =
4946
| Function: t<function_val>
5047
| Object: t<obj_val>
5148
| Symbol: t<symbol>
52-
| BigInt: t<bigint_val>
49+
| BigInt: t<bigint>
5350

5451
/**
5552
`test(value, t)` returns `true` if `value` is `typeof t`, otherwise `false`.
@@ -75,6 +72,6 @@ type tagged_t =
7572
| JSFunction(function_val)
7673
| JSObject(obj_val)
7774
| JSSymbol(symbol)
78-
| JSBigInt(bigint_val)
75+
| JSBigInt(bigint)
7976

8077
let classify: 'a => tagged_t

jscomp/test/typeof_test.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/test/typeof_test.res

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ let string_or_number = (type t, x) => {
1515
false
1616
| JSObject(_) => false
1717
| JSSymbol(_) => false
18-
| JSBigInt(_) => false
18+
| JSBigInt(v) =>
19+
v->Js.BigInt.toString->Js.log
20+
true
1921
}
2022
}
2123

0 commit comments

Comments
 (0)