fixes for dependencies and freedom typing

The freedom object can be used both as a constructor and as a function; this makes it a bit tricky to know what the type of the freedom object is. A solution is to make the Freedom type a Thenable of the function that then gives the on/emit interface for constructed module. That's what this pull request does.