fix(Generic Constraints d.ts): add to d.ts generic type parameters constraints.
This commit is contained in:
@@ -16,6 +16,8 @@ declare namespace JS_TESTS {
|
||||
function defaultParameters(x: number, y: string): string;
|
||||
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 foo.TestInterface & 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;
|
||||
const _const_val: number;
|
||||
|
||||
@@ -44,6 +44,15 @@ fun <T> generic1(x: T): T = x
|
||||
@JsExport
|
||||
fun <T> generic2(x: T?): Boolean = (x == null)
|
||||
|
||||
@JsExport
|
||||
fun <T: String> genericWithConstraint(x: T): T = x
|
||||
|
||||
@JsExport
|
||||
fun <T> genericWithMultipleConstraints(x: T): T
|
||||
where T : Comparable<T>,
|
||||
T : TestInterface,
|
||||
T : Throwable = x
|
||||
|
||||
@JsExport
|
||||
fun <A, B, C, D, E> generic3(a: A, b: B, c: C, d: D): E? = null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user