64 lines
1.7 KiB
Text
64 lines
1.7 KiB
Text
|
==== tests/cases/compiler/genericsWithoutTypeParameters1.ts (15 errors) ====
|
||
|
class C<T> {
|
||
|
foo(): T { return null }
|
||
|
}
|
||
|
|
||
|
interface I<T> {
|
||
|
bar(): T;
|
||
|
}
|
||
|
|
||
|
var c1: C;
|
||
|
~
|
||
|
!!! Generic type 'C<T>' requires 1 type argument(s).
|
||
|
var i1: I;
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
var c2: C<I>;
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
var i2: I<C>;
|
||
|
~
|
||
|
!!! Generic type 'C<T>' requires 1 type argument(s).
|
||
|
|
||
|
function foo(x: C, y: I) { }
|
||
|
~
|
||
|
!!! Generic type 'C<T>' requires 1 type argument(s).
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
function foo2(x: C<I>, y: I<C>) { }
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
~
|
||
|
!!! Generic type 'C<T>' requires 1 type argument(s).
|
||
|
|
||
|
var x: { a: C } = { a: new C<number>() };
|
||
|
~
|
||
|
!!! Generic type 'C<T>' requires 1 type argument(s).
|
||
|
var x2: { a: I } = { a: { bar() { return 1 } } };
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
|
||
|
class D<T> {
|
||
|
x: C;
|
||
|
~
|
||
|
!!! Generic type 'C<T>' requires 1 type argument(s).
|
||
|
y: D;
|
||
|
~
|
||
|
!!! Generic type 'D<T>' requires 1 type argument(s).
|
||
|
}
|
||
|
|
||
|
interface J<T> {
|
||
|
x: I;
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
y: J;
|
||
|
~
|
||
|
!!! Generic type 'J<T>' requires 1 type argument(s).
|
||
|
}
|
||
|
|
||
|
class A<T> { }
|
||
|
function f<T>(x: T): A {
|
||
|
~
|
||
|
!!! Generic type 'A<T>' requires 1 type argument(s).
|
||
|
return null;
|
||
|
}
|