class C { constructor(x: T) { } foo(x: U) { function bar(x: V) { return x; } return bar; } } var c = new C({ length: 2 }); var r = c.foo(''); var r2 = r({ length: 3, charAt: (x: number) => { '' } }); // error