Only generate module interfaces for direct dependent modules

Fixed a couple of issues with TypeScript formatting, too
Added a few TypeScript tests