Skip to content

Commit 1e479f4

Browse files
JSMonkSpace Team
authored andcommitted
[K/JS] Fixate wrong behavior of exporting interfaces with companions with ESM
1 parent 46b63d9 commit 1e479f4

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

js/js.translator/testData/typescript-export/js/module-systems-in-exported-file/esm.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ export declare namespace Parent {
7575
}
7676
}
7777
}
78+
export declare interface AnInterfaceWithCompanion {
79+
readonly __doNotUseOrImplementIt: {
80+
readonly "foo.AnInterfaceWithCompanion": unique symbol;
81+
};
82+
}
83+
export declare abstract class AnInterfaceWithCompanion extends KtSingleton<AnInterfaceWithCompanion.$metadata$.constructor>() {
84+
private constructor();
85+
}
86+
/** @deprecated $metadata$ is used for internal purposes, please don't use it in your code, because it can be removed at any moment */
87+
export declare namespace AnInterfaceWithCompanion.$metadata$ {
88+
abstract class constructor {
89+
get someValue(): string;
90+
private constructor();
91+
}
92+
}
7893
export declare function box(): string;
7994
export declare function asyncList(): Promise<KtList<number>>;
8095
export declare function arrayOfLists(): Array<KtList<number>>;

js/js.translator/testData/typescript-export/js/module-systems-in-exported-file/esm.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ object Parent {
4040
}
4141

4242

43+
interface AnInterfaceWithCompanion {
44+
companion object {
45+
val someValue = "OK"
46+
}
47+
}
48+
49+
4350
fun box(): String = "OK"
4451

4552

js/js.translator/testData/typescript-export/js/module-systems/esm.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ export declare namespace Parent {
7575
}
7676
}
7777
}
78+
export declare interface AnInterfaceWithCompanion {
79+
readonly __doNotUseOrImplementIt: {
80+
readonly "foo.AnInterfaceWithCompanion": unique symbol;
81+
};
82+
}
83+
export declare abstract class AnInterfaceWithCompanion extends KtSingleton<AnInterfaceWithCompanion.$metadata$.constructor>() {
84+
private constructor();
85+
}
86+
/** @deprecated $metadata$ is used for internal purposes, please don't use it in your code, because it can be removed at any moment */
87+
export declare namespace AnInterfaceWithCompanion.$metadata$ {
88+
abstract class constructor {
89+
get someValue(): string;
90+
private constructor();
91+
}
92+
}
7893
export declare function box(): string;
7994
export declare function asyncList(): Promise<KtList<number>>;
8095
export declare function arrayOfLists(): Array<KtList<number>>;

js/js.translator/testData/typescript-export/js/module-systems/esm.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ object Parent {
3434
}
3535
}
3636

37+
@JsExport
38+
interface AnInterfaceWithCompanion {
39+
companion object {
40+
val someValue = "OK"
41+
}
42+
}
43+
3744
@JsExport
3845
fun box(): String = "OK"
3946

0 commit comments

Comments
 (0)