[K/JS] fix(TS): save type hierarchy for exported classes.
This commit is contained in:
@@ -11,8 +11,8 @@ declare namespace JS_TESTS {
|
||||
function generic1<T>(x: T): T;
|
||||
function generic2<T>(x: Nullable<T>): boolean;
|
||||
function genericWithConstraint<T extends string>(x: T): T;
|
||||
function genericWithMultipleConstraints<T extends RegExpMatchArray & Error>(x: T): T;
|
||||
function genericWithMultipleConstraints<T extends unknown/* kotlin.Comparable<T> */ & RegExpMatchArray & Error>(x: T): T;
|
||||
function generic3<A, B, C, D, E>(a: A, b: B, c: C, d: D): Nullable<E>;
|
||||
function inlineFun(x: number, callback: (p0: number) => void): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ declare namespace JS_TESTS {
|
||||
constructor(value: any/* foo.NonExportedType */);
|
||||
get value(): any/* foo.NonExportedType */;
|
||||
set value(value: any/* foo.NonExportedType */);
|
||||
increment<T>(t: T): any/* foo.NonExportedType */;
|
||||
increment<T extends unknown/* foo.NonExportedType */>(t: T): any/* foo.NonExportedType */;
|
||||
}
|
||||
class B /* extends foo.NonExportedType */ {
|
||||
constructor(v: number);
|
||||
|
||||
@@ -13,6 +13,7 @@ declare namespace JS_TESTS {
|
||||
}
|
||||
}
|
||||
namespace foo {
|
||||
const fifth: (foo.Third<boolean> & foo.IA & foo.IG<boolean>)/* foo.Fifth<boolean> */;
|
||||
abstract class AC implements foo.I2 {
|
||||
constructor();
|
||||
get x(): string;
|
||||
@@ -100,5 +101,31 @@ declare namespace JS_TESTS {
|
||||
abstract get baz(): string;
|
||||
readonly __doNotUseOrImplementIt: foo.I3["__doNotUseOrImplementIt"];
|
||||
}
|
||||
interface IA {
|
||||
readonly foo: any;
|
||||
readonly __doNotUseOrImplementIt: {
|
||||
readonly "foo.IA": unique symbol;
|
||||
};
|
||||
}
|
||||
interface IG<T> {
|
||||
process(value: T): void;
|
||||
readonly __doNotUseOrImplementIt: {
|
||||
readonly "foo.IG": unique symbol;
|
||||
};
|
||||
}
|
||||
class Third<T> extends /* foo.Second */ foo.First {
|
||||
constructor();
|
||||
}
|
||||
class Sixth extends /* foo.Fifth<number> */ foo.Third<number> implements foo.IA, foo.IG<number>/*, foo.IC */ {
|
||||
constructor();
|
||||
process(value: number): void;
|
||||
get foo(): number;
|
||||
readonly __doNotUseOrImplementIt: foo.IA["__doNotUseOrImplementIt"] & foo.IG<number>["__doNotUseOrImplementIt"];
|
||||
}
|
||||
class First {
|
||||
constructor();
|
||||
}
|
||||
function acceptForthLike<T extends (foo.Third<string> & foo.IA)/* foo.Forth<string> */>(forth: T): void;
|
||||
function acceptMoreGenericForthLike<T extends foo.IA/* foo.IB */ & foo.IA/* foo.IC */ & foo.First/* foo.Second */>(forth: T): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,3 +163,53 @@ enum class EC : I3 {
|
||||
|
||||
override fun bay(): String = "bay"
|
||||
}
|
||||
|
||||
// Save hierarhy
|
||||
|
||||
@JsExport
|
||||
interface IA {
|
||||
val foo: Any
|
||||
}
|
||||
|
||||
@JsExport
|
||||
interface IG<T> {
|
||||
fun process(value: T): Unit
|
||||
}
|
||||
|
||||
interface IB : IA
|
||||
|
||||
interface IC : IB {
|
||||
override val foo: Any
|
||||
}
|
||||
|
||||
interface ID : IC {
|
||||
override val foo: Int
|
||||
}
|
||||
|
||||
@JsExport
|
||||
open class Third<T>: Second()
|
||||
|
||||
open class Forth<A>: Third<A>(), IB, ID {
|
||||
override val foo: Int = 42
|
||||
}
|
||||
|
||||
open class Fifth<B>: Forth<B>(), IG<B> {
|
||||
override fun process(value: B) {}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class Sixth: Fifth<Int>(), IC
|
||||
|
||||
@JsExport
|
||||
open class First
|
||||
|
||||
open class Second: First()
|
||||
|
||||
@JsExport
|
||||
fun <T : Forth<String>> acceptForthLike(forth: T) {}
|
||||
|
||||
@JsExport
|
||||
fun <T> acceptMoreGenericForthLike(forth: T) where T: IB, T: IC, T: Second {}
|
||||
|
||||
@JsExport
|
||||
val fifth = Fifth<Boolean>()
|
||||
|
||||
@@ -13,7 +13,7 @@ declare namespace JS_TESTS {
|
||||
generic1<T>(x: T): T;
|
||||
generic2<T>(x: Nullable<T>): boolean;
|
||||
genericWithConstraint<T extends string>(x: T): T;
|
||||
genericWithMultipleConstraints<T extends RegExpMatchArray & Error>(x: T): T;
|
||||
genericWithMultipleConstraints<T extends unknown/* kotlin.Comparable<T> */ & RegExpMatchArray & Error>(x: T): T;
|
||||
generic3<A, B, C, D, E>(a: A, b: B, c: C, d: D): Nullable<E>;
|
||||
inlineFun(x: number, callback: (p0: number) => void): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user