[K/JS] Add ability to exclude declarations from export by a new annotation @JsExport.Ignore.

This commit is contained in:
Artem Kobzar
2022-10-03 11:07:25 +00:00
committed by Space Team
parent 917c8606f5
commit eb2326eabb
49 changed files with 970 additions and 42 deletions
@@ -0,0 +1,52 @@
// RUN_PLAIN_BOX_FUNCTION
// IGNORE_BACKEND: JS
// MODULE: lib
// FILE: lib.kt
@JsExport
class Bar(val value: String) {
@JsExport.Ignore
constructor(): this("SECONDARY")
@JsExport.Ignore
val excludedValue: Int = 42
fun foo(): String = "FOO"
@JsExport.Ignore
fun excludedFun(): String = "EXCLUDED_FUN"
class Nested
@JsExport.Ignore
class ExcludedNested {
fun doSomething(): String = "SOMETHING"
}
companion object {
fun baz(): String = "BAZ"
@JsExport.Ignore
fun excludedFun(): String = "STATIC EXCLUDED_FUN"
}
}
// FILE: main.js
function box() {
var Bar = this.lib.Bar;
var bar = new Bar("TEST");
if (bar.value !== "TEST") return "Error: exported property was not exported"
if (bar.excludedValue === 42) return "Error: not exported property was exported"
if (bar.foo() !== "FOO") return "Error: exported function was not exported"
if (typeof bar.excludedFun === "function") return "Error: not exported function was exported"
if (typeof Bar.Nested !== "function") return "Error: exported nested class was not exported"
if (typeof Bar.ExcludedNested === "function") return "Error: not exported nested class was exported"
if (Bar.Companion.baz() !== "BAZ") return "Error: exported companion function was not exported"
if (typeof Bar.Companion.excludedFun === "function") return "Error: not exported companion function was exported"
return "OK"
}
@@ -0,0 +1,49 @@
// RUN_PLAIN_BOX_FUNCTION
// IGNORE_BACKEND: JS
// MODULE: lib
// FILE: lib.kt
@file:JsExport
val value: String = "TEST"
@JsExport.Ignore
val excludedValue: Int = 42
fun foo(): String = "FOO"
@JsExport.Ignore
fun excludedFun(): String = "EXCLUDED_FUN"
class SomeClass
@JsExport.Ignore
class ExcludedSomeClass {
fun doSomething(): String = "SOMETHING"
}
object Companion {
fun baz(): String = "BAZ"
@JsExport.Ignore
fun excludedFun(): String = "STATIC EXCLUDED_FUN"
}
// FILE: main.js
function box() {
var lib = this.lib;
if (lib.value !== "TEST") return "Error: exported property was not exported"
if (lib.excludedValue === 42) return "Error: not exported property was exported"
if (lib.foo() !== "FOO") return "Error: exported function was not exported"
if (typeof lib.excludedFun === "function") return "Error: not exported function was exported"
if (typeof lib.SomeClass !== "function") return "Error: exported nested class was not exported"
if (typeof lib.ExcludedSomeClass === "function") return "Error: not exported nested class was exported"
if (lib.Companion.baz() !== "BAZ") return "Error: exported companion function was not exported"
if (typeof lib.Companion.excludedFun === "function") return "Error: not exported companion function was exported"
return "OK"
}
@@ -0,0 +1,55 @@
// RUN_PLAIN_BOX_FUNCTION
// IGNORE_BACKEND: JS
// MODULE: lib
// FILE: lib.kt
@JsExport
val value: String = "TEST"
@JsExport
@JsExport.Ignore
val excludedValue: Int = 42
@JsExport
fun foo(): String = "FOO"
@JsExport
@JsExport.Ignore
fun excludedFun(): String = "EXCLUDED_FUN"
@JsExport
class SomeClass
@JsExport.Ignore
@JsExport
class ExcludedSomeClass {
fun doSomething(): String = "SOMETHING"
}
@JsExport
object Companion {
fun baz(): String = "BAZ"
@JsExport.Ignore
fun excludedFun(): String = "STATIC EXCLUDED_FUN"
}
// FILE: main.js
function box() {
var lib = this.lib;
if (lib.value !== "TEST") return "Error: exported property was not exported"
if (lib.excludedValue === 42) return "Error: not exported property was exported"
if (lib.foo() !== "FOO") return "Error: exported function was not exported"
if (typeof lib.excludedFun === "function") return "Error: not exported function was exported"
if (typeof lib.SomeClass !== "function") return "Error: exported nested class was not exported"
if (typeof lib.ExcludedSomeClass === "function") return "Error: not exported nested class was exported"
if (lib.Companion.baz() !== "BAZ") return "Error: exported companion function was not exported"
if (typeof lib.Companion.excludedFun === "function") return "Error: not exported companion function was exported"
return "OK"
}
@@ -0,0 +1,7 @@
declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined
namespace foo {
const foo: string;
function bar(): string;
}
}
@@ -0,0 +1,63 @@
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
// CHECK_TYPESCRIPT_DECLARATIONS
// RUN_PLAIN_BOX_FUNCTION
// SKIP_MINIFICATION
// SKIP_NODE_JS
// INFER_MAIN_MODULE
// MODULE: JS_TESTS
// WITH_STDLIB
// FILE: declarations.kt
@file:JsExport
package foo
@JsExport.Ignore
val baz: String = "Baz"
@JsExport.Ignore
fun inter(): String = "inter"
@JsExport.Ignore
class NotExportableNestedInsideInterface
@JsExport.Ignore
object Comanion {
val foo: String ="FOO"
}
val foo: String = "Foo"
fun bar() = "Bar"
@JsExport.Ignore
inline fun <A, reified B> A.notExportableReified(): Boolean = this is B
@JsExport.Ignore
suspend fun notExportableSuspend(): String = "SuspendResult"
@JsExport.Ignore
fun notExportableReturn(): List<String> = listOf("1", "2")
@JsExport.Ignore
val String.notExportableExentsionProperty: String
get() = "notExportableExentsionProperty"
@JsExport.Ignore
annotation class NotExportableAnnotation
@JsExport.Ignore
value class NotExportableInlineClass(val value: Int)
@@ -0,0 +1,33 @@
"use strict";
var foo = JS_TESTS.foo;
function assert(condition, message) {
if (message === void 0) { message = "Assertion failed"; }
if (!condition) {
throw message;
}
}
function box() {
assert(foo.foo === "Foo", "Error in property 'foo'");
assert(foo.bar() === "Bar", "Error in property 'bar'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.baz === undefined, "Error in property 'baz'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.inter === undefined, "Error in method 'inter'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableNestedInsideInterface === undefined, "Error in class 'NotExportableNestedInsideInterface'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.Companion === undefined, "Error in object 'Companion'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableReified === undefined, "Error in method 'notExportableReified'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableReturn === undefined, "Error in method 'notExportableReturn'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'");
return "OK";
}
@@ -0,0 +1,36 @@
import foo = JS_TESTS.foo;
function assert(condition: boolean, message: string = "Assertion failed") {
if (!condition) {
throw message;
}
}
function box(): string {
assert(foo.foo === "Foo", "Error in property 'foo'")
assert(foo.bar() === "Bar", "Error in property 'bar'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.baz === undefined, "Error in property 'baz'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.inter === undefined, "Error in method 'inter'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableNestedInsideInterface === undefined, "Error in class 'NotExportableNestedInsideInterface'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.Companion === undefined, "Error in object 'Companion'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableReified === undefined, "Error in method 'notExportableReified'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableReturn === undefined, "Error in method 'notExportableReturn'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'")
return "OK";
}
@@ -0,0 +1,4 @@
{
"include": [ "./*" ],
"extends": "../common.tsconfig.json"
}
@@ -0,0 +1,7 @@
declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined
namespace foo {
const foo: string;
function bar(): string;
}
}
@@ -0,0 +1,59 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// RUN_PLAIN_BOX_FUNCTION
// SKIP_MINIFICATION
// SKIP_NODE_JS
// INFER_MAIN_MODULE
// MODULE: JS_TESTS
// WITH_STDLIB
// FILE: declarations.kt
package foo
@JsExport
@JsExport.Ignore
val baz: String = "Baz"
@JsExport
@JsExport.Ignore
fun inter(): String = "inter"
@JsExport
@JsExport.Ignore
class NotExportableNestedInsideInterface
@JsExport.Ignore
@JsExport
object Comanion {
val foo: String ="FOO"
}
@JsExport
val foo: String = "Foo"
@JsExport
fun bar() = "Bar"
@JsExport.Ignore
@JsExport
inline fun <A, reified B> A.notExportableReified(): Boolean = this is B
@JsExport.Ignore
@JsExport
suspend fun notExportableSuspend(): String = "SuspendResult"
@JsExport
@JsExport.Ignore
fun notExportableReturn(): List<String> = listOf("1", "2")
@JsExport
@JsExport.Ignore
val String.notExportableExentsionProperty: String
get() = "notExportableExentsionProperty"
@JsExport
@JsExport.Ignore
annotation class NotExportableAnnotation
@JsExport
@JsExport.Ignore
value class NotExportableInlineClass(val value: Int)
@@ -0,0 +1,33 @@
"use strict";
var foo = JS_TESTS.foo;
function assert(condition, message) {
if (message === void 0) { message = "Assertion failed"; }
if (!condition) {
throw message;
}
}
function box() {
assert(foo.foo === "Foo", "Error in property 'foo'");
assert(foo.bar() === "Bar", "Error in property 'bar'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.baz === undefined, "Error in property 'baz'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.inter === undefined, "Error in method 'inter'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableNestedInsideInterface === undefined, "Error in class 'NotExportableNestedInsideInterface'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.Companion === undefined, "Error in object 'Companion'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableReified === undefined, "Error in method 'notExportableReified'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableReturn === undefined, "Error in method 'notExportableReturn'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'");
return "OK";
}
@@ -0,0 +1,36 @@
import foo = JS_TESTS.foo;
function assert(condition: boolean, message: string = "Assertion failed") {
if (!condition) {
throw message;
}
}
function box(): string {
assert(foo.foo === "Foo", "Error in property 'foo'")
assert(foo.bar() === "Bar", "Error in property 'bar'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.baz === undefined, "Error in property 'baz'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.inter === undefined, "Error in method 'inter'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableNestedInsideInterface === undefined, "Error in class 'NotExportableNestedInsideInterface'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.Companion === undefined, "Error in object 'Companion'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableReified === undefined, "Error in method 'notExportableReified'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableReturn === undefined, "Error in method 'notExportableReturn'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(foo.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'")
return "OK";
}
@@ -0,0 +1,4 @@
{
"include": [ "./*" ],
"extends": "../common.tsconfig.json"
}
@@ -0,0 +1,15 @@
declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined
namespace foo {
interface ExportedInterface {
readonly __doNotUseOrImplementIt: {
readonly "foo.ExportedInterface": unique symbol;
};
}
class OnlyFooParamExported implements foo.ExportedInterface {
constructor(foo: string);
get foo(): string;
readonly __doNotUseOrImplementIt: foo.ExportedInterface["__doNotUseOrImplementIt"];
}
}
}
@@ -0,0 +1,63 @@
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
// CHECK_TYPESCRIPT_DECLARATIONS
// RUN_PLAIN_BOX_FUNCTION
// SKIP_MINIFICATION
// SKIP_NODE_JS
// INFER_MAIN_MODULE
// MODULE: JS_TESTS
// WITH_STDLIB
// FILE: declarations.kt
@file:JsExport
package foo
interface ExportedInterface {
@JsExport.Ignore
val baz: String
@JsExport.Ignore
fun inter(): String
@JsExport.Ignore
class NotExportableNestedInsideInterface
@JsExport.Ignore
companion object {
val foo: String ="FOO"
}
}
class OnlyFooParamExported(val foo: String) : ExportedInterface {
@JsExport.Ignore
constructor() : this("TEST")
override val baz = "Baz"
override fun inter(): String = "Inter"
@JsExport.Ignore
val bar = "Bar"
@JsExport.Ignore
inline fun <A, reified B> A.notExportableReified(): Boolean = this is B
@JsExport.Ignore
suspend fun notExportableSuspend(): String = "SuspendResult"
@JsExport.Ignore
fun notExportableReturn(): List<String> = listOf("1", "2")
@JsExport.Ignore
val String.notExportableExentsionProperty: String
get() = "notExportableExentsionProperty"
@JsExport.Ignore
annotation class NotExportableAnnotation
@JsExport.Ignore
value class NotExportableInlineClass(val value: Int)
}
@@ -0,0 +1,32 @@
"use strict";
var OnlyFooParamExported = JS_TESTS.foo.OnlyFooParamExported;
function assert(condition, message) {
if (message === void 0) { message = "Assertion failed"; }
if (!condition) {
throw message;
}
}
function box() {
var onlyFooParamExported = new OnlyFooParamExported("TEST");
assert(OnlyFooParamExported.length === 1, "Error in constructor'");
assert(onlyFooParamExported.foo === "TEST", "Error in property 'foo'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.bar === undefined, "Error in property 'bar'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.baz === undefined, "Error in property 'baz'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.inter === undefined, "Error in method 'inter'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableReified === undefined, "Error in method 'notExportableReified'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableReturn === undefined, "Error in method 'notExportableReturn'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(OnlyFooParamExported.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(OnlyFooParamExported.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'");
return "OK";
}
@@ -0,0 +1,35 @@
import OnlyFooParamExported = JS_TESTS.foo.OnlyFooParamExported;
function assert(condition: boolean, message: string = "Assertion failed") {
if (!condition) {
throw message;
}
}
function box(): string {
const onlyFooParamExported = new OnlyFooParamExported("TEST")
assert(OnlyFooParamExported.length === 1, "Error in constructor'")
assert(onlyFooParamExported.foo === "TEST", "Error in property 'foo'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.bar === undefined, "Error in property 'bar'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.baz === undefined, "Error in property 'baz'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.inter === undefined, "Error in method 'inter'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableReified === undefined, "Error in method 'notExportableReified'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableReturn === undefined, "Error in method 'notExportableReturn'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(OnlyFooParamExported.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(OnlyFooParamExported.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'")
return "OK";
}
@@ -0,0 +1,4 @@
{
"include": [ "./*" ],
"extends": "../common.tsconfig.json"
}
@@ -0,0 +1,15 @@
declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined
namespace foo {
interface ExportedInterface {
readonly __doNotUseOrImplementIt: {
readonly "foo.ExportedInterface": unique symbol;
};
}
class OnlyFooParamExported implements foo.ExportedInterface {
constructor(foo: string);
get foo(): string;
readonly __doNotUseOrImplementIt: foo.ExportedInterface["__doNotUseOrImplementIt"];
}
}
}
@@ -0,0 +1,59 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// RUN_PLAIN_BOX_FUNCTION
// SKIP_MINIFICATION
// SKIP_NODE_JS
// INFER_MAIN_MODULE
// MODULE: JS_TESTS
// WITH_STDLIB
// FILE: declarations.kt
package foo
@JsExport
interface ExportedInterface {
@JsExport.Ignore
val baz: String
@JsExport.Ignore
fun inter(): String
@JsExport.Ignore
class NotExportableNestedInsideInterface
@JsExport.Ignore
companion object {
val foo: String ="FOO"
}
}
@JsExport
class OnlyFooParamExported(val foo: String) : ExportedInterface {
@JsExport.Ignore
constructor() : this("TEST")
override val baz = "Baz"
override fun inter(): String = "Inter"
@JsExport.Ignore
val bar = "Bar"
@JsExport.Ignore
inline fun <A, reified B> A.notExportableReified(): Boolean = this is B
@JsExport.Ignore
suspend fun notExportableSuspend(): String = "SuspendResult"
@JsExport.Ignore
fun notExportableReturn(): List<String> = listOf("1", "2")
@JsExport.Ignore
val String.notExportableExentsionProperty: String
get() = "notExportableExentsionProperty"
@JsExport.Ignore
annotation class NotExportableAnnotation
@JsExport.Ignore
value class NotExportableInlineClass(val value: Int)
}
@@ -0,0 +1,32 @@
"use strict";
var OnlyFooParamExported = JS_TESTS.foo.OnlyFooParamExported;
function assert(condition, message) {
if (message === void 0) { message = "Assertion failed"; }
if (!condition) {
throw message;
}
}
function box() {
var onlyFooParamExported = new OnlyFooParamExported("TEST");
assert(OnlyFooParamExported.length === 1, "Error in constructor'");
assert(onlyFooParamExported.foo === "TEST", "Error in property 'foo'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.bar === undefined, "Error in property 'bar'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.baz === undefined, "Error in property 'baz'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.inter === undefined, "Error in method 'inter'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableReified === undefined, "Error in method 'notExportableReified'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableReturn === undefined, "Error in method 'notExportableReturn'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(OnlyFooParamExported.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'");
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(OnlyFooParamExported.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'");
return "OK";
}
@@ -0,0 +1,35 @@
import OnlyFooParamExported = JS_TESTS.foo.OnlyFooParamExported;
function assert(condition: boolean, message: string = "Assertion failed") {
if (!condition) {
throw message;
}
}
function box(): string {
const onlyFooParamExported = new OnlyFooParamExported("TEST")
assert(OnlyFooParamExported.length === 1, "Error in constructor'")
assert(onlyFooParamExported.foo === "TEST", "Error in property 'foo'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.bar === undefined, "Error in property 'bar'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.baz === undefined, "Error in property 'baz'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.inter === undefined, "Error in method 'inter'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableReified === undefined, "Error in method 'notExportableReified'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableSuspend === undefined, "Error in method 'notExportableSuspend'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableReturn === undefined, "Error in method 'notExportableReturn'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(onlyFooParamExported.notExportableExentsionProperty === undefined, "Error in method 'notExportableExentsionProperty'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(OnlyFooParamExported.NotExportableAnnotation === undefined, "Error in nested class 'NotExportableAnnotation'")
// @ts-expect-error "the param should not be exported either in TS, or in JS"
assert(OnlyFooParamExported.NotExportableInlineClass === undefined, "Error in nested class 'NotExportableInlineClass'")
return "OK";
}
@@ -0,0 +1,4 @@
{
"include": [ "./*" ],
"extends": "../common.tsconfig.json"
}