Typed laziness

Fixes for the JS Codegen