File: augmentedTypesModules2.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (61 lines) | stat: -rw-r--r-- 1,158 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
=== tests/cases/compiler/augmentedTypesModules2.ts ===
// module then function
module m2 { }
function m2() { }; // ok since the module is not instantiated
>m2 : () => void

module m2a { var y = 2; }
>m2a : typeof m2a
>y : number
>2 : 2

function m2a() { }; // error since the module is instantiated
>m2a : typeof m2a

module m2b { export var y = 2; }
>m2b : typeof m2b
>y : number
>2 : 2

function m2b() { };  // error since the module is instantiated
>m2b : typeof m2b

function m2c() { }; 
>m2c : typeof m2c

module m2c { export var y = 2; } 
>m2c : typeof m2c
>y : number
>2 : 2

module m2cc { export var y = 2; }
>m2cc : typeof m2cc
>y : number
>2 : 2

function m2cc() { }; // error to have module first
>m2cc : typeof m2cc

module m2d { }
declare function m2d(): void; 
>m2d : () => void

declare function m2e(): void; 
>m2e : () => void

module m2e { }

function m2f() { };
>m2f : () => void

module m2f { export interface I { foo(): void } } 
>foo : () => void

function m2g() { };
>m2g : typeof m2g

module m2g { export class C { foo() { } } } 
>m2g : typeof m2g
>C : C
>foo : () => void