Get scrollHeight to adjust textarea size

Hello,
I am trying to something like this:

I can set interval like so:

setInterval(function(){
  setVar("this", "height", 0)
  setVar("this", "height", getVar("this", "scrollHeight"));
}, 50)

after setting:
height: VAR{height, 100}

But how do I get the value for scrollHeight?

Note that I ultimately want to do this but with an expanding textarea:

Thanks in advance

setInterval(function(){
  setVar("this", "height", 0)
  setVar("this", "height", (get("this").split(/\r|\r\n|\n/).length * getVar("this", "line-height") * getVar("this", "font-size")));
}, 50)

As there is no asYouType for textarea, I guess this could just go in onValue without the timer.

Textarea's scrollHeight attribute is not exposed, your second post is pretty much the only option available (but you'd need to provide line-height and font-size values since these are not defined as custom variables).