2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts (7 errors) ====
|
|
|
|
// Should be error to use 'T' in all declarations within Foo.
|
|
|
|
class Foo<T> {
|
|
|
|
static a = (n: T) => { };
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2302: Static members cannot reference class type parameters.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
static b: T;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2302: Static members cannot reference class type parameters.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
static c: T[] = [];
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2302: Static members cannot reference class type parameters.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
static d = false || ((x: T) => x || undefined)(null)
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2302: Static members cannot reference class type parameters.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
static e = function (x: T) { return null; }
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2302: Static members cannot reference class type parameters.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
static f(xs: T[]): T[] {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2302: Static members cannot reference class type parameters.
|
2014-07-13 01:04:16 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2302: Static members cannot reference class type parameters.
|
2014-07-13 01:04:16 +02:00
|
|
|
return xs.reverse();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|