[JS/IR] fix: add ability to render type constraints into TypeScript definitions.

This commit is contained in:
Artem Kobzar
2022-07-13 15:20:27 +00:00
committed by Space
parent f1f4ae7359
commit 117df325c9
7 changed files with 18 additions and 3 deletions
@@ -81,7 +81,7 @@ data class ExportedRegularClass(
val isAbstract: Boolean = false,
override val superClass: ExportedType? = null,
override val superInterfaces: List<ExportedType> = emptyList(),
val typeParameters: List<String>,
val typeParameters: List<ExportedType.TypeParameter>,
override val members: List<ExportedDeclaration>,
override val nestedClasses: List<ExportedClass>,
override val ir: IrClass,
@@ -378,7 +378,7 @@ class ExportModelGenerator(
members: List<ExportedDeclaration>,
nestedClasses: List<ExportedClass>
): ExportedDeclaration {
val typeParameters = klass.typeParameters.map { it.name.identifier }
val typeParameters = klass.typeParameters.map(::exportTypeParameter)
// TODO: Handle non-exported super types
@@ -258,7 +258,7 @@ class ExportModelToTsDeclarations {
}
val renderedTypeParameters = if (typeParameters.isNotEmpty()) {
"<" + typeParameters.joinToString(", ") + ">"
"<" + typeParameters.joinToString(", ") { it.toTypeScript(indent) } + ">"
} else {
""
}