I have a way I've improved this: “don't”.
IMO, if you want to write JS, write JS. Use a minimal abstraction layer to communicate
from Lift—whether those are events on `document` or the streaming promises David put
into Lift 3, either way. Or use, a full abstraction like Scala.js (zero experience here). But
trying to do properly-typed JS the way that our JsExp stuff currently does is, IMO, simply
adding cognitive overhead where it's not needed by trying to shoehorn JS into a state
it doesn't want to exist in.
Then again, I'm a strong “separation of concerns” advocate, and I'm a strong “let your
environment guide you to the truth” advocate, and so I think keeping JS in JS helps
enforce the separation of browser vs server concerns very effectively.
Thanks,
Antonio