getting usedTypes recursively