2014-07-13 01:04:16 +02:00
|
|
|
//// [genericCallWithObjectLiteralArgs.ts]
|
|
|
|
function foo<T>(x: { bar: T; baz: T }) {
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2014-10-10 23:41:14 +02:00
|
|
|
var r = foo({ bar: 1, baz: '' }); // error
|
2014-07-13 01:04:16 +02:00
|
|
|
var r2 = foo({ bar: 1, baz: 1 }); // T = number
|
2014-08-27 19:06:16 +02:00
|
|
|
var r3 = foo({ bar: foo, baz: foo }); // T = typeof foo
|
2014-07-13 01:04:16 +02:00
|
|
|
var r4 = foo<Object>({ bar: 1, baz: '' }); // T = Object
|
|
|
|
|
|
|
|
//// [genericCallWithObjectLiteralArgs.js]
|
|
|
|
function foo(x) {
|
|
|
|
return x;
|
|
|
|
}
|
2014-10-10 23:41:14 +02:00
|
|
|
var r = foo({ bar: 1, baz: '' }); // error
|
2014-08-15 22:18:54 +02:00
|
|
|
var r2 = foo({ bar: 1, baz: 1 }); // T = number
|
2014-08-27 19:06:16 +02:00
|
|
|
var r3 = foo({ bar: foo, baz: foo }); // T = typeof foo
|
2014-08-15 23:32:08 +02:00
|
|
|
var r4 = foo({ bar: 1, baz: '' }); // T = Object
|