TypeScript/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.js
Sheetal Nandi 6ab3adfd43 Modified the emitComment logic to handle emitting leading or trailing spaces depending on flags
Leading comments have trailing separator while trailing comments have leading space
This removes the extra trailing space in the trailing comments
2014-08-15 14:32:08 -07:00

26 lines
723 B
TypeScript

//// [genericCallWithConstraintsTypeArgumentInference2.ts]
// Generic call with parameters of T and U, U extends T, no parameter of type U
function foo<T, U extends T>(t: T) {
var u: U;
return u;
}
var r = foo(1); // ok
var r2 = foo(null); // {}
var r3 = foo(new Object()); // {}
var r4 = foo<Date, Date>(1); // error
var r5 = foo<Date, Date>(new Date()); // no error
//// [genericCallWithConstraintsTypeArgumentInference2.js]
// Generic call with parameters of T and U, U extends T, no parameter of type U
function foo(t) {
var u;
return u;
}
var r = foo(1); // ok
var r2 = foo(null); // {}
var r3 = foo(new Object()); // {}
var r4 = foo(1); // error
var r5 = foo(new Date()); // no error