[K/JS] Generating TypeScript definitions for exceptions and rest of the types ^Fixed KT-53940
This commit is contained in:
+1
-2
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.ir.util.isObject
|
||||
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||
import org.jetbrains.kotlin.js.common.isValidES5Identifier
|
||||
import org.jetbrains.kotlin.serialization.js.ModuleKind
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
|
||||
private const val Nullable = "Nullable"
|
||||
@@ -318,7 +317,7 @@ class ExportModelToTsDeclarations {
|
||||
" /* extends $implicitlyExportedClassesString */"
|
||||
} else {
|
||||
val originallyDefinedSuperClass = implicitlyExportedClassesString.takeIf { it.isNotEmpty() }?.let { "/* $it */ " }.orEmpty()
|
||||
val transitivelyDefinedSuperClass = firstIsInstance<ExportedType.ClassType>().toTypeScript(indent, false)
|
||||
val transitivelyDefinedSuperClass = single { it !is ExportedType.ImplicitlyExportedType }.toTypeScript(indent, false)
|
||||
" extends $originallyDefinedSuperClass$transitivelyDefinedSuperClass"
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -42,5 +42,8 @@ declare namespace JS_TESTS {
|
||||
const console: Console;
|
||||
const error: WebAssembly.CompileError;
|
||||
function functionWithTypeAliasInside(x: any/* foo.NonExportedGenericInterface<foo.NonExportedType> */): any/* foo.NonExportedGenericInterface<foo.NonExportedType> */;
|
||||
class TheNewException extends Error {
|
||||
constructor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -92,4 +92,7 @@ typealias NotExportedTypeAlias = NonExportedGenericInterface<NonExportedType>
|
||||
@JsExport
|
||||
fun functionWithTypeAliasInside(x: NotExportedTypeAlias): NotExportedTypeAlias {
|
||||
return x
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class TheNewException: Throwable()
|
||||
Reference in New Issue
Block a user