2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/genericWithOpenTypeParameters1.ts (3 errors) ====
|
|
|
|
class B<T> {
|
|
|
|
foo(x: T): T { return null; }
|
|
|
|
}
|
|
|
|
|
|
|
|
var x: B<number>;
|
|
|
|
x.foo(1); // no error
|
|
|
|
var f = <T>(x: B<T>) => { return x.foo(1); } // error
|
2014-07-25 02:00:03 +02:00
|
|
|
~
|
2014-07-25 04:39:50 +02:00
|
|
|
!!! Argument of type 'number' is not assignable to parameter of type 'T'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var f2 = <T>(x: B<T>) => { return x.foo<T>(1); } // error
|
|
|
|
~~~~~~~~~~~
|
|
|
|
!!! Supplied parameters do not match any signature of call target.
|
|
|
|
var f3 = <T>(x: B<T>) => { return x.foo<number>(1); } // error
|
|
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
!!! Supplied parameters do not match any signature of call target.
|
|
|
|
var f4 = (x: B<number>) => { return x.foo(1); } // no error
|
|
|
|
|