Skip to content

fix JSBigInt payload type #6911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
- Turn off transformation for closures inside loops when capturing loop variables, now that `let` is emitted instead of `var`. https://github.com/rescript-lang/rescript-compiler/pull/6480
- Improve unused attribute warning message. https://github.com/rescript-lang/rescript-compiler/pull/6787
- Remove internal option `use-stdlib` from build schema. https://github.com/rescript-lang/rescript-compiler/pull/6778
- Fix `Js.Types.JSBigInt` payload to use native `bigint` type. https://github.com/rescript-lang/rescript-compiler/pull/6911

# 11.1.2

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ export const date0: (x:Date) => Date = CoreJS.date0 as any;

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

export const bigint0: (x:BigInt) => BigInt = CoreJS.bigint0 as any;

export const bigint1: (x:BigInt) => BigInt = CoreJS.bigint1 as any;
export const bigint0: (x:bigint) => bigint = CoreJS.bigint0 as any;

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

Expand Down
5 changes: 1 addition & 4 deletions jscomp/gentype_tests/typescript-react-example/src/Core.res
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ let date0 = (x: Js.Date.t) => x
let date1 = (x: Date.t) => x

@genType
let bigint0 = (x: Js.Types.bigint_val) => x

@genType
let bigint1 = (x: BigInt.t) => x
let bigint0 = (x: bigint) => x

@genType
let regexp0 = (x: Js.Re.t) => x
Expand Down
5 changes: 0 additions & 5 deletions jscomp/gentype_tests/typescript-react-example/src/Core.res.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions jscomp/others/js_types.res
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
/** Js symbol type only available in ES6 */
type symbol

/** Js bigint type only available in ES2020 */
type bigint_val = bigint

type obj_val
/** This type has only one value `undefined` */
type undefined_val
Expand All @@ -46,7 +43,7 @@ type rec t<_> =
| Function: t<function_val>
| Object: t<obj_val>
| Symbol: t<symbol>
| BigInt: t<bigint_val>
| BigInt: t<bigint>

type tagged_t =
| JSFalse
Expand All @@ -58,7 +55,7 @@ type tagged_t =
| JSFunction(function_val)
| JSObject(obj_val)
| JSSymbol(symbol)
| JSBigInt(bigint_val)
| JSBigInt(bigint)

let classify = (x: 'a): tagged_t => {
let ty = Js.typeof(x)
Expand Down
7 changes: 2 additions & 5 deletions jscomp/others/js_types.resi
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
/** Js symbol type (only available in ES6) */
type symbol

/** Js bigint type only available in ES2020 */
type bigint_val

type obj_val

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

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

let classify: 'a => tagged_t
3 changes: 3 additions & 0 deletions jscomp/test/typeof_test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion jscomp/test/typeof_test.res
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ let string_or_number = (type t, x) => {
false
| JSObject(_) => false
| JSSymbol(_) => false
| JSBigInt(_) => false
| JSBigInt(v) =>
v->Js.BigInt.toString->Js.log
true
}
}

Expand Down