diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/export/ExportModelGenerator.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/export/ExportModelGenerator.kt index 84c7783ffa9..eeee825ebbe 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/export/ExportModelGenerator.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/export/ExportModelGenerator.kt @@ -379,7 +379,7 @@ class ExportModelGenerator(val context: JsIrBackendContext, val generateNamespac private fun IrClass.shouldContainImplementationOfMagicProperty(superTypes: Iterable): Boolean { return !isExternal && superTypes.any { val superClass = it.classOrNull?.owner ?: return@any false - superClass.isInterface && superClass.isExported(context) || superClass.isJsImplicitExport() + superClass.isInterface && it.shouldAddMagicPropertyOfSuper() || superClass.isJsImplicitExport() } } diff --git a/js/js.translator/testData/typescript-export/interfaces-in-exported-file/interfaces.d.ts b/js/js.translator/testData/typescript-export/interfaces-in-exported-file/interfaces.d.ts index 7c1324ebc4e..c814c106b18 100644 --- a/js/js.translator/testData/typescript-export/interfaces-in-exported-file/interfaces.d.ts +++ b/js/js.translator/testData/typescript-export/interfaces-in-exported-file/interfaces.d.ts @@ -5,6 +5,8 @@ declare namespace JS_TESTS { readonly required: number; readonly notRequired?: Nullable; } + interface ExportedParentInterface { + } } namespace foo { interface TestInterface { @@ -45,5 +47,11 @@ declare namespace JS_TESTS { readonly "foo.InterfaceWithCompanion": unique symbol; }; } + interface ExportedChildInterface extends foo.ExportedParentInterface { + bar(): void; + readonly __doNotUseOrImplementIt: { + readonly "foo.ExportedChildInterface": unique symbol; + }; + } } } diff --git a/js/js.translator/testData/typescript-export/interfaces-in-exported-file/interfaces.kt b/js/js.translator/testData/typescript-export/interfaces-in-exported-file/interfaces.kt index 5e848f11755..333afe7985b 100644 --- a/js/js.translator/testData/typescript-export/interfaces-in-exported-file/interfaces.kt +++ b/js/js.translator/testData/typescript-export/interfaces-in-exported-file/interfaces.kt @@ -65,4 +65,12 @@ interface InterfaceWithCompanion { companion object { fun foo() = "String" } +} + + +external interface ExportedParentInterface + + +interface ExportedChildInterface : ExportedParentInterface { + fun bar() } \ No newline at end of file diff --git a/js/js.translator/testData/typescript-export/interfaces/interfaces.d.ts b/js/js.translator/testData/typescript-export/interfaces/interfaces.d.ts index 7c1324ebc4e..c814c106b18 100644 --- a/js/js.translator/testData/typescript-export/interfaces/interfaces.d.ts +++ b/js/js.translator/testData/typescript-export/interfaces/interfaces.d.ts @@ -5,6 +5,8 @@ declare namespace JS_TESTS { readonly required: number; readonly notRequired?: Nullable; } + interface ExportedParentInterface { + } } namespace foo { interface TestInterface { @@ -45,5 +47,11 @@ declare namespace JS_TESTS { readonly "foo.InterfaceWithCompanion": unique symbol; }; } + interface ExportedChildInterface extends foo.ExportedParentInterface { + bar(): void; + readonly __doNotUseOrImplementIt: { + readonly "foo.ExportedChildInterface": unique symbol; + }; + } } } diff --git a/js/js.translator/testData/typescript-export/interfaces/interfaces.kt b/js/js.translator/testData/typescript-export/interfaces/interfaces.kt index ae5024d4fd4..504a2504d58 100644 --- a/js/js.translator/testData/typescript-export/interfaces/interfaces.kt +++ b/js/js.translator/testData/typescript-export/interfaces/interfaces.kt @@ -61,4 +61,12 @@ interface InterfaceWithCompanion { companion object { fun foo() = "String" } +} + +@JsExport +external interface ExportedParentInterface + +@JsExport +interface ExportedChildInterface : ExportedParentInterface { + fun bar() } \ No newline at end of file