File: errorsInGenericTypeReference.ts

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (71 lines) | stat: -rw-r--r-- 2,015 bytes parent folder | download | duplicates (7)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

interface IFoo<T> { }

class Foo<T> { }


// in call type arguments
class testClass1 {
    method<T>(): void { }
}
var tc1 = new testClass1();
tc1.method<{ x: V }>(); // error: could not find symbol V


// in constructor type arguments
class testClass2<T> {
}
var tc2 = new testClass2<{ x: V }>(); // error: could not find symbol V


// in method return type annotation
class testClass3 {
    testMethod1(): Foo<{ x: V }> { return null; } // error: could not find symbol V
    static testMethod2(): Foo<{ x: V }> { return null } // error: could not find symbol V
    set a(value: Foo<{ x: V }>) { } // error: could not find symbol V
    property: Foo<{ x: V }>; // error: could not find symbol V
}


// in function return type annotation
function testFunction1(): Foo<{ x: V }> { return null; } // error: could not find symbol V


// in paramter types
function testFunction2(p: Foo<{ x: V }>) { }// error: could not find symbol V


// in var type annotation
var f: Foo<{ x: V }>; // error: could not find symbol V


// in constraints
class testClass4<T extends { x: V }> { } // error: could not find symbol V

interface testClass5<T extends Foo<{ x: V }>> { } // error: could not find symbol V

class testClass6<T> {
    method<M extends { x: V }>(): void { } // error: could not find symbol V
}

interface testInterface1 {
    new <M extends { x: V }>(a: M); // error: could not find symbol V
}


// in extends clause
class testClass7 extends Foo<{ x: V }> { } // error: could not find symbol V


// in implements clause
class testClass8 implements IFoo<{ x: V }> { } // error: could not find symbol V


// in signatures
interface testInterface2 {
    new (a: Foo<{ x: V }>): Foo<{ x: V }>; //2x: error: could not find symbol V
    [x: string]: Foo<{ x: V }>; // error: could not find symbol V
    method(a: Foo<{ x: V }>): Foo<{ x: V }>; //2x: error: could not find symbol V
    property: Foo<{ x: V }>; // error: could not find symbol V
}