I am merging this ahead of the great typeshed reshuffling. Any remaining issues can be addressed later.