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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
//// [tests/cases/compiler/importDecl.ts] ////
//// [importDecl_require.ts]
export class d {
foo: string;
}
export var x: d;
export function foo(): d { return null; }
//// [importDecl_require1.ts]
export class d {
bar: string;
}
var x: d;
export function foo(): d { return null; }
//// [importDecl_require2.ts]
export class d {
baz: string;
}
export var x: d;
export function foo(): d { return null; }
//// [importDecl_require3.ts]
export class d {
bing: string;
}
export var x: d;
export function foo(): d { return null; }
//// [importDecl_require4.ts]
import m4 = require("./importDecl_require");
export function foo2(): m4.d { return null; }
//// [importDecl_1.ts]
///<reference path='importDecl_require.ts'/>
///<reference path='importDecl_require1.ts'/>
///<reference path='importDecl_require2.ts'/>
///<reference path='importDecl_require3.ts'/>
///<reference path='importDecl_require4.ts'/>
import m4 = require("./importDecl_require"); // Emit used
export var x4 = m4.x;
export var d4 = m4.d;
export var f4 = m4.foo();
export module m1 {
export var x2 = m4.x;
export var d2 = m4.d;
export var f2 = m4.foo();
var x3 = m4.x;
var d3 = m4.d;
var f3 = m4.foo();
}
//Emit global only usage
import glo_m4 = require("./importDecl_require1");
export var useGlo_m4_d4 = glo_m4.d;
export var useGlo_m4_f4 = glo_m4.foo();
//Emit even when used just in function type
import fncOnly_m4 = require("./importDecl_require2");
export var useFncOnly_m4_f4 = fncOnly_m4.foo();
// only used privately no need to emit
import private_m4 = require("./importDecl_require3");
export module usePrivate_m4_m1 {
var x3 = private_m4.x;
var d3 = private_m4.d;
var f3 = private_m4.foo();
}
// Do not emit unused import
import m5 = require("./importDecl_require4");
export var d = m5.foo2();
// Do not emit multiple used import statements
import multiImport_m4 = require("./importDecl_require"); // Emit used
export var useMultiImport_m4_x4 = multiImport_m4.x;
export var useMultiImport_m4_d4 = multiImport_m4.d;
export var useMultiImport_m4_f4 = multiImport_m4.foo();
//// [importDecl_require.js]
"use strict";
exports.__esModule = true;
var d = /** @class */ (function () {
function d() {
}
return d;
}());
exports.d = d;
function foo() { return null; }
exports.foo = foo;
//// [importDecl_require1.js]
"use strict";
exports.__esModule = true;
var d = /** @class */ (function () {
function d() {
}
return d;
}());
exports.d = d;
var x;
function foo() { return null; }
exports.foo = foo;
//// [importDecl_require2.js]
"use strict";
exports.__esModule = true;
var d = /** @class */ (function () {
function d() {
}
return d;
}());
exports.d = d;
function foo() { return null; }
exports.foo = foo;
//// [importDecl_require3.js]
"use strict";
exports.__esModule = true;
var d = /** @class */ (function () {
function d() {
}
return d;
}());
exports.d = d;
function foo() { return null; }
exports.foo = foo;
//// [importDecl_require4.js]
"use strict";
exports.__esModule = true;
function foo2() { return null; }
exports.foo2 = foo2;
//// [importDecl_1.js]
"use strict";
exports.__esModule = true;
///<reference path='importDecl_require.ts'/>
///<reference path='importDecl_require1.ts'/>
///<reference path='importDecl_require2.ts'/>
///<reference path='importDecl_require3.ts'/>
///<reference path='importDecl_require4.ts'/>
var m4 = require("./importDecl_require"); // Emit used
exports.x4 = m4.x;
exports.d4 = m4.d;
exports.f4 = m4.foo();
var m1;
(function (m1) {
m1.x2 = m4.x;
m1.d2 = m4.d;
m1.f2 = m4.foo();
var x3 = m4.x;
var d3 = m4.d;
var f3 = m4.foo();
})(m1 = exports.m1 || (exports.m1 = {}));
//Emit global only usage
var glo_m4 = require("./importDecl_require1");
exports.useGlo_m4_d4 = glo_m4.d;
exports.useGlo_m4_f4 = glo_m4.foo();
//Emit even when used just in function type
var fncOnly_m4 = require("./importDecl_require2");
exports.useFncOnly_m4_f4 = fncOnly_m4.foo();
// only used privately no need to emit
var private_m4 = require("./importDecl_require3");
var usePrivate_m4_m1;
(function (usePrivate_m4_m1) {
var x3 = private_m4.x;
var d3 = private_m4.d;
var f3 = private_m4.foo();
})(usePrivate_m4_m1 = exports.usePrivate_m4_m1 || (exports.usePrivate_m4_m1 = {}));
// Do not emit unused import
var m5 = require("./importDecl_require4");
exports.d = m5.foo2();
// Do not emit multiple used import statements
var multiImport_m4 = require("./importDecl_require"); // Emit used
exports.useMultiImport_m4_x4 = multiImport_m4.x;
exports.useMultiImport_m4_d4 = multiImport_m4.d;
exports.useMultiImport_m4_f4 = multiImport_m4.foo();
//// [importDecl_require.d.ts]
export declare class d {
foo: string;
}
export declare var x: d;
export declare function foo(): d;
//// [importDecl_require1.d.ts]
export declare class d {
bar: string;
}
export declare function foo(): d;
//// [importDecl_require2.d.ts]
export declare class d {
baz: string;
}
export declare var x: d;
export declare function foo(): d;
//// [importDecl_require3.d.ts]
export declare class d {
bing: string;
}
export declare var x: d;
export declare function foo(): d;
//// [importDecl_require4.d.ts]
import m4 = require("./importDecl_require");
export declare function foo2(): m4.d;
//// [importDecl_1.d.ts]
/// <reference path="importDecl_require.d.ts" />
/// <reference path="importDecl_require1.d.ts" />
/// <reference path="importDecl_require2.d.ts" />
/// <reference path="importDecl_require3.d.ts" />
/// <reference path="importDecl_require4.d.ts" />
import m4 = require("./importDecl_require");
export declare var x4: m4.d;
export declare var d4: typeof m4.d;
export declare var f4: m4.d;
export declare module m1 {
var x2: m4.d;
var d2: typeof m4.d;
var f2: m4.d;
}
import glo_m4 = require("./importDecl_require1");
export declare var useGlo_m4_d4: typeof glo_m4.d;
export declare var useGlo_m4_f4: glo_m4.d;
import fncOnly_m4 = require("./importDecl_require2");
export declare var useFncOnly_m4_f4: fncOnly_m4.d;
export declare module usePrivate_m4_m1 {
}
export declare var d: m4.d;
export declare var useMultiImport_m4_x4: m4.d;
export declare var useMultiImport_m4_d4: typeof m4.d;
export declare var useMultiImport_m4_f4: m4.d;
|