2014-07-13 01:04:16 +02:00
|
|
|
//// [objectLiteralFunctionArgContextualTyping2.ts]
|
|
|
|
interface I2 {
|
|
|
|
value: string;
|
|
|
|
doStuff: (t: string) => string;
|
|
|
|
}
|
|
|
|
|
|
|
|
function f2(args: I2) { }
|
|
|
|
|
|
|
|
f2({ hello: 1 })
|
|
|
|
f2({ value: '' })
|
|
|
|
f2({ value: '', what: 1 })
|
|
|
|
f2({ toString: (s) => s })
|
|
|
|
f2({ toString: (s: string) => s })
|
|
|
|
f2({ value: '', toString: (s) => s.uhhh })
|
|
|
|
|
|
|
|
//// [objectLiteralFunctionArgContextualTyping2.js]
|
2015-02-07 03:45:09 +01:00
|
|
|
function f2(args) { }
|
2014-07-13 01:04:16 +02:00
|
|
|
f2({ hello: 1 });
|
|
|
|
f2({ value: '' });
|
|
|
|
f2({ value: '', what: 1 });
|
|
|
|
f2({ toString: function (s) { return s; } });
|
|
|
|
f2({ toString: function (s) { return s; } });
|
|
|
|
f2({ value: '', toString: function (s) { return s.uhhh; } });
|