File: moduleScoping.js

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (42 lines) | stat: -rw-r--r-- 1,074 bytes parent folder | download | duplicates (2)
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
//// [tests/cases/conformance/externalModules/moduleScoping.ts] ////

//// [file1.ts]
var v1 = "sausages"; // Global scope

//// [file2.ts]
var v2 = 42; // Global scope
var v4 = () => 5;

//// [file3.ts]
export var v3 = true;
var v2 = [1,2,3]; // Module scope. Should not appear in global scope

//// [file4.ts]
import file3 = require('./file3');
var t1 = v1;
var t2 = v2;
var t3 = file3.v3;
var v4 = {a: true, b: NaN};  // Should shadow global v2 in this module

//// [file5.ts]
var x = v2; // Should be global v2 of type number again


//// [file1.js]
var v1 = "sausages"; // Global scope
//// [file2.js]
var v2 = 42; // Global scope
var v4 = function () { return 5; };
//// [file3.js]
"use strict";
exports.v3 = true;
var v2 = [1, 2, 3]; // Module scope. Should not appear in global scope
//// [file4.js]
"use strict";
var file3 = require("./file3");
var t1 = v1;
var t2 = v2;
var t3 = file3.v3;
var v4 = { a: true, b: NaN }; // Should shadow global v2 in this module
//// [file5.js]
var x = v2; // Should be global v2 of type number again