Use a linked hash set for type parameters
Code cleanup
Add newline at end of TypeScript output
Reworked TypeScript generation, added tests