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

9 lines
182 B
TypeScript

class C<T> {
public bar2<U extends T>(x: T, y: U): T {
return null;
}
}
var x = new C<number>();
x.bar2(2, ""); // should error
x.bar2<string>(2, ""); // should error