[JS IR] .d.ts generation for module systems
Support .d.ts generation for UMD, AMD, CommonJS module kinds in addition to existing "plain" module kind.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
type Nullable<T> = T | null | undefined
|
||||
export namespace foo {
|
||||
const prop: number;
|
||||
class C {
|
||||
constructor(x: number);
|
||||
readonly x: number;
|
||||
doubleX(): number;
|
||||
}
|
||||
function box(): string;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// MODULE_KIND: COMMON_JS
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
val prop = 10
|
||||
|
||||
class C(val x: Int) {
|
||||
fun doubleX() = x * 2
|
||||
}
|
||||
|
||||
fun box(): String = "OK"
|
||||
@@ -0,0 +1,12 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
const prop: number;
|
||||
class C {
|
||||
constructor(x: number);
|
||||
readonly x: number;
|
||||
doubleX(): number;
|
||||
}
|
||||
function box(): string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
val prop = 10
|
||||
|
||||
class C(val x: Int) {
|
||||
fun doubleX() = x * 2
|
||||
}
|
||||
|
||||
fun box(): String = "OK"
|
||||
@@ -0,0 +1,11 @@
|
||||
type Nullable<T> = T | null | undefined
|
||||
export namespace foo {
|
||||
const prop: number;
|
||||
class C {
|
||||
constructor(x: number);
|
||||
readonly x: number;
|
||||
doubleX(): number;
|
||||
}
|
||||
function box(): string;
|
||||
}
|
||||
export as namespace JS_TESTS;
|
||||
@@ -0,0 +1,16 @@
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// MODULE_KIND: UMD
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
val prop = 10
|
||||
|
||||
class C(val x: Int) {
|
||||
fun doubleX() = x * 2
|
||||
}
|
||||
|
||||
fun box(): String = "OK"
|
||||
Reference in New Issue
Block a user