Fix recursive functions in type definitions