1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(3,20): error TS2302: Static members cannot reference class type parameters.
tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(5,15): error TS2302: Static members cannot reference class type parameters.
tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(7,15): error TS2302: Static members cannot reference class type parameters.
tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(9,30): error TS2302: Static members cannot reference class type parameters.
tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(11,29): error TS2302: Static members cannot reference class type parameters.
tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(13,18): error TS2302: Static members cannot reference class type parameters.
tests/cases/compiler/genericClassWithStaticsUsingTypeArguments.ts(13,24): error TS2302: Static members cannot reference class type parameters.
==== 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) => { };
~
!!! error TS2302: Static members cannot reference class type parameters.
static b: T;
~
!!! error TS2302: Static members cannot reference class type parameters.
static c: T[] = [];
~
!!! error TS2302: Static members cannot reference class type parameters.
static d = false || ((x: T) => x || undefined)(null)
~
!!! error TS2302: Static members cannot reference class type parameters.
static e = function (x: T) { return null; }
~
!!! error TS2302: Static members cannot reference class type parameters.
static f(xs: T[]): T[] {
~
!!! error TS2302: Static members cannot reference class type parameters.
~
!!! error TS2302: Static members cannot reference class type parameters.
return xs.reverse();
}
}
|