File: augmentedTypesModules.errors.txt

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 (127 lines) | stat: -rw-r--r-- 4,487 bytes parent folder | download | duplicates (5)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
tests/cases/compiler/augmentedTypesModules.ts(5,8): error TS2300: Duplicate identifier 'm1a'.
tests/cases/compiler/augmentedTypesModules.ts(6,5): error TS2300: Duplicate identifier 'm1a'.
tests/cases/compiler/augmentedTypesModules.ts(8,8): error TS2300: Duplicate identifier 'm1b'.
tests/cases/compiler/augmentedTypesModules.ts(9,5): error TS2300: Duplicate identifier 'm1b'.
tests/cases/compiler/augmentedTypesModules.ts(16,8): error TS2300: Duplicate identifier 'm1d'.
tests/cases/compiler/augmentedTypesModules.ts(19,5): error TS2300: Duplicate identifier 'm1d'.
tests/cases/compiler/augmentedTypesModules.ts(25,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged.
tests/cases/compiler/augmentedTypesModules.ts(28,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged.
tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged.


==== tests/cases/compiler/augmentedTypesModules.ts (9 errors) ====
    // module then var
    module m1 { }
    var m1 = 1; // Should be allowed
    
    module m1a { var y = 2; } // error
           ~~~
!!! error TS2300: Duplicate identifier 'm1a'.
    var m1a = 1; // error
        ~~~
!!! error TS2300: Duplicate identifier 'm1a'.
    
    module m1b { export var y = 2; } // error
           ~~~
!!! error TS2300: Duplicate identifier 'm1b'.
    var m1b = 1; // error
        ~~~
!!! error TS2300: Duplicate identifier 'm1b'.
    
    module m1c {
        export interface I { foo(): void; }
    }
    var m1c = 1; // Should be allowed
    
    module m1d { // error
           ~~~
!!! error TS2300: Duplicate identifier 'm1d'.
        export class I { foo() { } }
    }
    var m1d = 1; // error
        ~~~
!!! error TS2300: Duplicate identifier 'm1d'.
    
    // module then function
    module m2 { }
    function m2() { }; // ok since the module is not instantiated
    
    module m2a { var y = 2; }
           ~~~
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged.
    function m2a() { }; // error since the module is instantiated
    
    module m2b { export var y = 2; }
           ~~~
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged.
    function m2b() { };  // error since the module is instantiated
    
    // should be errors to have function first
    function m2c() { }; 
    module m2c { export var y = 2; } 
    
    module m2d { }
    declare function m2d(): void; 
    
    declare function m2e(): void; 
    module m2e { }
    
    function m2f() { };
    module m2f { export interface I { foo(): void } } 
    
    function m2g() { };
    module m2g { export class C { foo() { } } } 
    
    // module then class
    module m3 { }
    class m3 { } // ok since the module is not instantiated
    
    module m3a { var y = 2; }
           ~~~
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged.
    class m3a { foo() { } } // error, class isn't ambient or declared before the module
    
    class m3b { foo() { } }
    module m3b { var y = 2; }
    
    class m3c { foo() { } }
    module m3c { export var y = 2; } 
    
    declare class m3d { foo(): void }
    module m3d { export var y = 2; } 
    
    module m3e { export var y = 2; } 
    declare class m3e { foo(): void } 
    
    declare class m3f { foo(): void }
    module m3f { export interface I { foo(): void } }
    
    declare class m3g { foo(): void }
    module m3g { export class C { foo() { } } }
    
    // module then enum
    // should be errors
    module m4 { }
    enum m4 { }
    
    module m4a { var y = 2; }
    enum m4a { One }
    
    module m4b { export var y = 2; }
    enum m4b { One }
    
    module m4c { interface I { foo(): void } }
    enum m4c { One }
    
    module m4d { class C { foo() { } } }
    enum m4d { One }
    
    //// module then module
    
    module m5 { export var y = 2; }
    module m5 { export interface I { foo(): void } } // should already be reasonably well covered
    
    // module then import
    module m6 { export var y = 2; }
    //import m6 = require('');