Converting Js.t('a) in ReasonML to ReScript

I’m converting the following ReasonML type into ReScript:

type context('props, 'params) = {
    params: Js.t('params),
    query: Js.Dict.t(string),
    req: Req.t,
    res: Res.t,

I’m assuming that Js.t('params) just becomes 'params in ReScript as follows:

type context<'props, 'params> = {
  params: 'params,
  query: Js.Dict.t<string>,
  req: Req.t,
  res: Res.t,

Is that correct?

Yeah, since ReScript does provide a proper “JS object like” syntax, we don’t really want to use the Js.t type here anymore. Good thing you pointed that out, I will convert the NextJS rescript template to ReScript syntax soon and update a few bindings as well.

You can check out how we did it in the blog, which uses GetStaticProps as well.

  • Here we adapted the 'params so it doesn’t use Js.t anymore
  • Here is how we use it in our page
1 Like

@ryyppy, great, thanks for confirming. And I’ll look forward to the update of the NextJS ReScript template!