generalize type alias handling. fixes issue 2