2014-07-13 01:04:16 +02:00
|
|
|
//// [inferentialTypingWithFunctionTypeSyntacticScenarios.ts]
|
|
|
|
declare function map<T, U>(array: T, func: (x: T) => U): U;
|
|
|
|
declare function identity<V>(y: V): V;
|
|
|
|
var s: string;
|
|
|
|
|
|
|
|
// dotted name
|
|
|
|
var dottedIdentity = { x: identity };
|
|
|
|
s = map("", dottedIdentity.x);
|
|
|
|
|
|
|
|
// index expression
|
|
|
|
s = map("", dottedIdentity['x']);
|
|
|
|
|
|
|
|
// function call
|
|
|
|
s = map("", (() => identity)());
|
|
|
|
|
|
|
|
// construct
|
|
|
|
interface IdentityConstructor {
|
|
|
|
new (): typeof identity;
|
|
|
|
}
|
|
|
|
var ic: IdentityConstructor;
|
|
|
|
s = map("", new ic());
|
|
|
|
|
|
|
|
// assignment
|
|
|
|
var t;
|
|
|
|
s = map("", t = identity);
|
|
|
|
|
|
|
|
// type assertion
|
|
|
|
s = map("", <typeof identity>identity);
|
|
|
|
|
|
|
|
// parenthesized expression
|
|
|
|
s = map("", (identity));
|
|
|
|
|
|
|
|
// comma
|
|
|
|
s = map("", ("", identity));
|
|
|
|
|
|
|
|
//// [inferentialTypingWithFunctionTypeSyntacticScenarios.js]
|
|
|
|
var s;
|
2014-08-12 00:54:12 +02:00
|
|
|
// dotted name
|
2014-07-13 01:04:16 +02:00
|
|
|
var dottedIdentity = { x: identity };
|
|
|
|
s = map("", dottedIdentity.x);
|
2014-08-16 00:49:09 +02:00
|
|
|
// index expression
|
2014-07-13 01:04:16 +02:00
|
|
|
s = map("", dottedIdentity['x']);
|
2014-08-16 00:49:09 +02:00
|
|
|
// function call
|
2014-07-13 01:04:16 +02:00
|
|
|
s = map("", (function () { return identity; })());
|
|
|
|
var ic;
|
|
|
|
s = map("", new ic());
|
2014-08-12 00:54:12 +02:00
|
|
|
// assignment
|
2014-07-13 01:04:16 +02:00
|
|
|
var t;
|
|
|
|
s = map("", t = identity);
|
2014-08-16 00:49:09 +02:00
|
|
|
// type assertion
|
2014-07-13 01:04:16 +02:00
|
|
|
s = map("", identity);
|
2014-08-16 00:49:09 +02:00
|
|
|
// parenthesized expression
|
2014-07-13 01:04:16 +02:00
|
|
|
s = map("", (identity));
|
2014-08-16 00:49:09 +02:00
|
|
|
// comma
|
2014-07-13 01:04:16 +02:00
|
|
|
s = map("", ("", identity));
|