add support for unexposed type definitions

desperately need tests.