fun additionalParent()

in build-logic/generatorlegacybuild/src/main/kotlin/karakum/browser/IterableRegistry.kt [49:76]


    fun additionalParent(type: String): String? {
        if (type == "ReadableStream") {
            require(additionalParentMap[type] == null)
            return "AsyncIterable<R>"
        }

        if (type == "FileSystemDirectoryHandle") {
            require(additionalParentMap[type] == null)
            return "AsyncMapLike<String, FileSystemHandle>"
        }

        var result = additionalParentMap[type]
            ?: return null

        result = sequenceOf(
            "Set<" to "MutableSetLike<",
            "Map<" to "MutableMapLike<",
        ).fold(result) { acc, (from, to) ->
            if (acc.startsWith(from)) {
                acc.replaceFirst(from, to)
            } else acc
        }

        return result
            .replace("<string, AudioParam>", "<AudioParamName, AudioParam>")
            .replace("string", "String")
            .replace(" any>", " JsAny?>")
    }