flatten

Flattens the list of KoTypeArgumentDeclaration objects into a list of KoBaseTypeDeclaration objects.

This method recursively extracts all the type arguments and their source type declarations, producing a flat list that includes both the outer types and their nested generic types.

For example:

  • For a type argument like String, it returns listOf().

  • For a type argument like List<String>, it returns listOf(String).

  • For a type argument like Map<List<String>, Int>, it returns listOf(List, String, Int).

Return

A flattened list of KoBaseTypeDeclaration objects, representing the source types of all type arguments and their nested types.