[K/JS] Fix Companion object overriding problem inside TypeScript Definitions ^JBAI-680 Fixed

This commit is contained in:
Artem Kobzar
2024-02-29 17:48:24 +00:00
committed by Space Team
parent f1ed07d3bb
commit 1c2570ed7e
6 changed files with 63 additions and 6 deletions
@@ -41,6 +41,18 @@ declare namespace JS_TESTS {
function createNested1(): typeof foo.Parent.Nested1;
function createNested2(): foo.Parent.Nested1.Nested2;
function createNested3(): foo.Parent.Nested1.Nested2.Companion.Nested3;
abstract class BaseWithCompanion {
constructor();
static get Companion(): {
get any(): string;
};
}
/* @ts-ignore: https://github.com/microsoft/TypeScript/issues/4628 */
class ChildWithCompanion extends foo.BaseWithCompanion {
constructor();
static get Companion(): {
};
}
}
namespace _objects_ {
const foo$Parent$Nested1: {
@@ -63,4 +63,15 @@ fun createNested2(): Parent.Nested1.Nested2 {
fun createNested3(): Parent.Nested1.Nested2.Companion.Nested3 {
return Parent.Nested1.Nested2.Companion.Nested3()
}
abstract class BaseWithCompanion {
companion object {
val any: String = "ANYTHING"
}
}
class ChildWithCompanion : BaseWithCompanion() {
companion object
}
@@ -7,6 +7,8 @@ import createNested1 = JS_TESTS.foo.createNested1;
import createNested2 = JS_TESTS.foo.createNested2;
import createNested3 = JS_TESTS.foo.createNested3;
import WithSimpleObjectInside = JS_TESTS.foo.WithSimpleObjectInside;
import BaseWithCompanion = JS_TESTS.foo.BaseWithCompanion;
import ChildWithCompanion = JS_TESTS.foo.ChildWithCompanion;
function assert(condition: boolean) {
if (!condition) {
@@ -34,5 +36,6 @@ function box(): string {
assert(WithSimpleObjectInside.value === "WithSimpleObjectInside");
assert(WithSimpleObjectInside.SimpleObject.value === "SimpleObject");
return "OK";
}
@@ -41,6 +41,18 @@ declare namespace JS_TESTS {
function createNested1(): typeof foo.Parent.Nested1;
function createNested2(): foo.Parent.Nested1.Nested2;
function createNested3(): foo.Parent.Nested1.Nested2.Companion.Nested3;
abstract class BaseWithCompanion {
constructor();
static get Companion(): {
get any(): string;
};
}
/* @ts-ignore: https://github.com/microsoft/TypeScript/issues/4628 */
class ChildWithCompanion extends foo.BaseWithCompanion {
constructor();
static get Companion(): {
};
}
}
namespace _objects_ {
const foo$Parent$Nested1: {
@@ -59,4 +59,15 @@ fun createNested2(): Parent.Nested1.Nested2 {
@JsExport
fun createNested3(): Parent.Nested1.Nested2.Companion.Nested3 {
return Parent.Nested1.Nested2.Companion.Nested3()
}
@JsExport
abstract class BaseWithCompanion {
companion object {
val any: String = "ANYTHING"
}
}
@JsExport
class ChildWithCompanion : BaseWithCompanion() {
companion object
}