in build-logic/generatorlegacybuild/src/main/kotlin/karakum/query/Types.kt [27:43]
fun parseTypeParameters(
source: String,
): List<String> {
if (!source.endsWith(">")) {
return emptyList<String>()
}
return source.substringAfter("<")
.removeSuffix(">")
.replace(" extends QueryOptions<any, any, any, ", " extends QueryOptions<*, *, *, ")
.replace(" any[]", " ReadonlyArray<*>")
.splitToSequence(", ")
.map { it.substringBefore(" = ") }
.map { it.replace(" extends ", ": ") }
.map { if (it.endsWith(": Function")) "$it<*>" else it }
.toList()
}