TypeScript Fixes

Let me know if you have any problems with these commits.