move asSTypeRep to library