Fixes to freedom typescript API; generalizations and type-params

* Added type-params for on and emit. 
* updated to Freedom 0.5