TypeScript/tests/cases/compiler/genericObjectLitReturnType.ts
2014-07-12 17:30:19 -07:00

11 lines
186 B
TypeScript

class X<T>
{
f(t: T) { return { a: t }; }
}
var x: X<number>;
var t1 = x.f(5);
t1.a = 5; // Should not error: t1 should have type {a: number}, instead has type {a: T}