[K/JS] Add ES6 typescript tests + fix a few bugs for it

This commit is contained in:
Artem Kobzar
2023-11-30 13:37:06 +00:00
committed by Space Team
parent c569fc170b
commit 98186ec283
9 changed files with 875 additions and 22 deletions
@@ -1,7 +1,5 @@
/** This file is generated by {@link :js:js.test:generateTypeScriptJsExportOnFileTests} task. DO NOT MODIFY MANUALLY */
// TARGET_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// CHECK_TYPESCRIPT_DECLARATIONS
// RUN_PLAIN_BOX_FUNCTION
// SKIP_MINIFICATION
@@ -1,5 +1,3 @@
// TARGET_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// CHECK_TYPESCRIPT_DECLARATIONS
// RUN_PLAIN_BOX_FUNCTION
// SKIP_MINIFICATION
@@ -2,23 +2,14 @@ import SomeBaseClass = JS_TESTS.foo.SomeBaseClass;
import SomeExtendingClass = JS_TESTS.foo.SomeExtendingClass;
import FinalClassInChain = JS_TESTS.foo.FinalClassInChain;
function assert(condition: boolean) {
if (!condition) {
throw "Assertion failed";
}
}
function box(): string {
// @ts-expect-error "the constructor is private and can't be used from JS/TS code"
const baseClass = new SomeBaseClass(4)
assert(baseClass.answer === 4)
new SomeBaseClass(4)
// @ts-expect-error "the constructor is private and can't be used from JS/TS code"
const extendingClass = new SomeExtendingClass()
assert(extendingClass.answer === 42)
new SomeExtendingClass()
const finalClassInChain = new FinalClassInChain()
assert(finalClassInChain.answer === 42)
new FinalClassInChain()
return "OK";
}