Closed
Description
ReScript is internally using the object system within Js.t
to allow structural typing.
e.g.
type user = { "name": string }
is expressed as Js.t < name : string >
. This is kinda an implementation detail, but there are scenarios where you can use the :>
operator to coerce between different object shapes explicitly.
e.g. x :> { . }
In ReScript lingo, we call Js.t<...>
types Objects
. Our current docs are covered in the Objects docs. Not sure if subtyping should be an advanced section here.