30 lines
738 B
TypeScript
30 lines
738 B
TypeScript
//// [subtypesOfTypeParameterWithConstraints3.ts]
|
|
// checking whether other types are subtypes of type parameters with constraints
|
|
|
|
function f<T extends U, U, V>(t: T, u: U, v: V) {
|
|
// ok
|
|
var r = true ? t : u;
|
|
var r = true ? u : t;
|
|
|
|
// ok
|
|
var r2 = true ? t : v;
|
|
var r2 = true ? v : t;
|
|
|
|
// ok
|
|
var r3 = true ? v : u;
|
|
var r3 = true ? u : v;
|
|
}
|
|
|
|
//// [subtypesOfTypeParameterWithConstraints3.js]
|
|
// checking whether other types are subtypes of type parameters with constraints
|
|
function f(t, u, v) {
|
|
// ok
|
|
var r = true ? t : u;
|
|
var r = true ? u : t;
|
|
// ok
|
|
var r2 = true ? t : v;
|
|
var r2 = true ? v : t;
|
|
// ok
|
|
var r3 = true ? v : u;
|
|
var r3 = true ? u : v;
|
|
}
|