Fixes to make tsc 1.0 happier

This isn't enough to make everything compile, but we're down to very few remaining issues.