86 lines
2.8 KiB
Text
86 lines
2.8 KiB
Text
|
==== tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts (24 errors) ====
|
||
|
// it is an error to use a generic type without type arguments
|
||
|
// all of these are errors
|
||
|
|
||
|
interface I<T> {
|
||
|
foo: T;
|
||
|
}
|
||
|
|
||
|
var c: I;
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
|
||
|
var a: { x: I };
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
var b: { (x: I): I };
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
var d: { [x: I]: I };
|
||
|
~
|
||
|
!!! An index signature parameter type must be 'string' or 'number'.
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
|
||
|
var e = (x: I) => { var y: I; return y; }
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
|
||
|
function f(x: I): I { var y: I; return y; }
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
|
||
|
var g = function f(x: I): I { var y: I; return y; }
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
|
||
|
class D extends I {
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
}
|
||
|
|
||
|
interface U extends I {}
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
|
||
|
module M {
|
||
|
export interface E<T> { foo: T }
|
||
|
}
|
||
|
|
||
|
class D2 extends M.C { }
|
||
|
~~~
|
||
|
!!! Module 'M' has no exported member 'C'.
|
||
|
interface D3<T extends M.E> { }
|
||
|
~~~
|
||
|
!!! Generic type 'E<T>' requires 1 type argument(s).
|
||
|
interface I2 extends M.C { }
|
||
|
~~~
|
||
|
!!! Module 'M' has no exported member 'C'.
|
||
|
|
||
|
function h<T extends I>(x: T) { }
|
||
|
~
|
||
|
!!! Generic type 'I<T>' requires 1 type argument(s).
|
||
|
function i<T extends M.E>(x: T) { }
|
||
|
~~~
|
||
|
!!! Generic type 'E<T>' requires 1 type argument(s).
|
||
|
|
||
|
var j = <C>null;
|
||
|
~
|
||
|
!!! Cannot find name 'C'.
|
||
|
var k = <M.E>null;
|
||
|
~~~
|
||
|
!!! Generic type 'E<T>' requires 1 type argument(s).
|