TypeScript/tests/baselines/reference/genericFunctions0.types

15 lines
596 B
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/genericFunctions0.ts ===
function foo<T > (x: T) { return x; }
2015-04-13 23:01:57 +02:00
>foo : <T>(x: T) => T, Symbol(foo, Decl(genericFunctions0.ts, 0, 0))
>T : T, Symbol(T, Decl(genericFunctions0.ts, 0, 13))
>x : T, Symbol(x, Decl(genericFunctions0.ts, 0, 18))
>T : T, Symbol(T, Decl(genericFunctions0.ts, 0, 13))
>x : T, Symbol(x, Decl(genericFunctions0.ts, 0, 18))
2014-08-15 23:33:16 +02:00
var x = foo<number>(5); // 'x' should be number
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(genericFunctions0.ts, 2, 3))
2014-08-15 23:33:16 +02:00
>foo<number>(5) : number
2015-04-13 23:01:57 +02:00
>foo : <T>(x: T) => T, Symbol(foo, Decl(genericFunctions0.ts, 0, 0))
2015-04-13 21:36:11 +02:00
>5 : number
2014-08-15 23:33:16 +02:00