[K/JS] Fix interfaces inside TypeScript definitions if they have only an external interface parent ^KT-64708 Fixed
Merge-request: KT-MR-14665 Merged-by: Artem Kobzar <Artem.Kobzar@jetbrains.com>
This commit is contained in:
+1
-1
@@ -379,7 +379,7 @@ class ExportModelGenerator(val context: JsIrBackendContext, val generateNamespac
|
|||||||
private fun IrClass.shouldContainImplementationOfMagicProperty(superTypes: Iterable<IrType>): Boolean {
|
private fun IrClass.shouldContainImplementationOfMagicProperty(superTypes: Iterable<IrType>): Boolean {
|
||||||
return !isExternal && superTypes.any {
|
return !isExternal && superTypes.any {
|
||||||
val superClass = it.classOrNull?.owner ?: return@any false
|
val superClass = it.classOrNull?.owner ?: return@any false
|
||||||
superClass.isInterface && superClass.isExported(context) || superClass.isJsImplicitExport()
|
superClass.isInterface && it.shouldAddMagicPropertyOfSuper() || superClass.isJsImplicitExport()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
@@ -5,6 +5,8 @@ declare namespace JS_TESTS {
|
|||||||
readonly required: number;
|
readonly required: number;
|
||||||
readonly notRequired?: Nullable<number>;
|
readonly notRequired?: Nullable<number>;
|
||||||
}
|
}
|
||||||
|
interface ExportedParentInterface {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
namespace foo {
|
namespace foo {
|
||||||
interface TestInterface {
|
interface TestInterface {
|
||||||
@@ -45,5 +47,11 @@ declare namespace JS_TESTS {
|
|||||||
readonly "foo.InterfaceWithCompanion": unique symbol;
|
readonly "foo.InterfaceWithCompanion": unique symbol;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
interface ExportedChildInterface extends foo.ExportedParentInterface {
|
||||||
|
bar(): void;
|
||||||
|
readonly __doNotUseOrImplementIt: {
|
||||||
|
readonly "foo.ExportedChildInterface": unique symbol;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
@@ -65,4 +65,12 @@ interface InterfaceWithCompanion {
|
|||||||
companion object {
|
companion object {
|
||||||
fun foo() = "String"
|
fun foo() = "String"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
external interface ExportedParentInterface
|
||||||
|
|
||||||
|
|
||||||
|
interface ExportedChildInterface : ExportedParentInterface {
|
||||||
|
fun bar()
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,8 @@ declare namespace JS_TESTS {
|
|||||||
readonly required: number;
|
readonly required: number;
|
||||||
readonly notRequired?: Nullable<number>;
|
readonly notRequired?: Nullable<number>;
|
||||||
}
|
}
|
||||||
|
interface ExportedParentInterface {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
namespace foo {
|
namespace foo {
|
||||||
interface TestInterface {
|
interface TestInterface {
|
||||||
@@ -45,5 +47,11 @@ declare namespace JS_TESTS {
|
|||||||
readonly "foo.InterfaceWithCompanion": unique symbol;
|
readonly "foo.InterfaceWithCompanion": unique symbol;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
interface ExportedChildInterface extends foo.ExportedParentInterface {
|
||||||
|
bar(): void;
|
||||||
|
readonly __doNotUseOrImplementIt: {
|
||||||
|
readonly "foo.ExportedChildInterface": unique symbol;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,4 +61,12 @@ interface InterfaceWithCompanion {
|
|||||||
companion object {
|
companion object {
|
||||||
fun foo() = "String"
|
fun foo() = "String"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsExport
|
||||||
|
external interface ExportedParentInterface
|
||||||
|
|
||||||
|
@JsExport
|
||||||
|
interface ExportedChildInterface : ExportedParentInterface {
|
||||||
|
fun bar()
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user