Generating getter for method in record

Is there a option to generate getter for method in a record?

E. g., for this ReScript code:

type state = Init

type api = {state: unit => state}

let instance: api = {
  let state = ref(Init)

  {state: () => state.contents}
}

In the generated js code can we replace state instance method:

var instance = {
  state: (function () {
      return state.contents;
    })
};

with a state getter?:

var instance = {
  get state() {
    return state.contents;
  }
};

Technically, yes

let instance = {
  let state = ref(Init)

  Object.createWithNullAndProperties({
    "state": {
      "get": () => state.contents
    }
  })
}

Though I think just using a getState function makes it much more clear that the value can change over time, in a language where we really rely on the immutability of record properties

Thanks. Just for a context, this may be useful in a situation with an API that you cannot change.