How to switch to v8.2.0

Hi, everyone.
My bsb version is v8.4.2, which is the latest, now.
However, the only example from the official site that compiled successfully on my machine is <v8.2.0(ML, the older one).

external random: unit -> float = "random"
[@@bs.val][@@bs.scope "Math"]

let someNumber = random ()

What I expected is an example of v8.2.0 compiled successfully.

How to switch to 8.2.0? I’ve tried to look over the configuration section, but I didn’t found it. (Aren’t the version of bsb & version of language synchronized?)

What’s your file extension? If you’re using .res, you should use the new (ReScript) syntax, like this:

@bs.val @bs.scope("Math")
external random: unit => float = "random"

let someNumber = random()

@bs.val @bs.scope(("window", "location", "ancestorOrigins"))
external length: int = "length"

OTOH, if you use the old syntax, the extension should be .re (ReasonML).

1 Like