2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/genericObjectLitReturnType.ts ===
|
|
|
|
class X<T>
|
2015-04-13 22:54:22 +02:00
|
|
|
>X : X<T>, Symbol(X,Decl(genericObjectLitReturnType.ts,0,0))
|
|
|
|
>T : T, Symbol(T,Decl(genericObjectLitReturnType.ts,0,8))
|
2014-08-15 23:33:16 +02:00
|
|
|
{
|
|
|
|
f(t: T) { return { a: t }; }
|
2015-04-13 22:54:22 +02:00
|
|
|
>f : (t: T) => { a: T; }, Symbol(f,Decl(genericObjectLitReturnType.ts,1,1))
|
|
|
|
>t : T, Symbol(t,Decl(genericObjectLitReturnType.ts,2,6))
|
|
|
|
>T : T, Symbol(T,Decl(genericObjectLitReturnType.ts,0,8))
|
2014-08-15 23:33:16 +02:00
|
|
|
>{ a: t } : { a: T; }
|
2015-04-13 22:54:22 +02:00
|
|
|
>a : T, Symbol(a,Decl(genericObjectLitReturnType.ts,2,22))
|
|
|
|
>t : T, Symbol(t,Decl(genericObjectLitReturnType.ts,2,6))
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var x: X<number>;
|
2015-04-13 22:54:22 +02:00
|
|
|
>x : X<number>, Symbol(x,Decl(genericObjectLitReturnType.ts,6,3))
|
|
|
|
>X : X<T>, Symbol(X,Decl(genericObjectLitReturnType.ts,0,0))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var t1 = x.f(5);
|
2015-04-13 22:54:22 +02:00
|
|
|
>t1 : { a: number; }, Symbol(t1,Decl(genericObjectLitReturnType.ts,7,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>x.f(5) : { a: number; }
|
2015-04-13 22:54:22 +02:00
|
|
|
>x.f : (t: number) => { a: number; }, Symbol(X.f,Decl(genericObjectLitReturnType.ts,1,1))
|
|
|
|
>x : X<number>, Symbol(x,Decl(genericObjectLitReturnType.ts,6,3))
|
|
|
|
>f : (t: number) => { a: number; }, Symbol(X.f,Decl(genericObjectLitReturnType.ts,1,1))
|
2015-04-13 21:36:11 +02:00
|
|
|
>5 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
t1.a = 5; // Should not error: t1 should have type {a: number}, instead has type {a: T}
|
|
|
|
>t1.a = 5 : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>t1.a : number, Symbol(a,Decl(genericObjectLitReturnType.ts,2,22))
|
|
|
|
>t1 : { a: number; }, Symbol(t1,Decl(genericObjectLitReturnType.ts,7,3))
|
|
|
|
>a : number, Symbol(a,Decl(genericObjectLitReturnType.ts,2,22))
|
2015-04-13 21:36:11 +02:00
|
|
|
>5 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
|