@@ -6096,19 +6096,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
6096
6096
}
6097
6097
}
6098
6098
6099
- function emitVar ( ) {
6100
- if ( languageVersion <= ScriptTarget . ES5 ) {
6101
- write ( "var " ) ;
6102
- }
6103
- else {
6104
- write ( "const " ) ;
6105
- }
6106
- }
6107
-
6108
6099
function emitExternalImportDeclaration ( node : ImportDeclaration | ImportEqualsDeclaration ) {
6109
6100
if ( contains ( externalImports , node ) ) {
6110
6101
const isExportedImport = node . kind === SyntaxKind . ImportEqualsDeclaration && ( node . flags & NodeFlags . Export ) !== 0 ;
6111
6102
const namespaceDeclaration = getNamespaceDeclarationNode ( node ) ;
6103
+ const varOrConst = ( languageVersion <= ScriptTarget . ES5 ) ? "var " : "const " ;
6112
6104
6113
6105
if ( modulekind !== ModuleKind . AMD ) {
6114
6106
emitLeadingComments ( node ) ;
@@ -6117,7 +6109,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
6117
6109
// import x = require("foo")
6118
6110
// import * as x from "foo"
6119
6111
if ( ! isExportedImport ) {
6120
- emitVar ( ) ;
6112
+ write ( varOrConst ) ;
6121
6113
} ;
6122
6114
emitModuleMemberName ( namespaceDeclaration ) ;
6123
6115
write ( " = " ) ;
@@ -6130,7 +6122,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
6130
6122
// import d, { x, y } from "foo"
6131
6123
const isNakedImport = SyntaxKind . ImportDeclaration && ! ( < ImportDeclaration > node ) . importClause ;
6132
6124
if ( ! isNakedImport ) {
6133
- emitVar ( ) ;
6125
+ write ( varOrConst ) ;
6134
6126
write ( getGeneratedNameForNode ( < ImportDeclaration > node ) ) ;
6135
6127
write ( " = " ) ;
6136
6128
}
@@ -6157,7 +6149,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
6157
6149
}
6158
6150
else if ( namespaceDeclaration && isDefaultImport ( node ) ) {
6159
6151
// import d, * as x from "foo"
6160
- emitVar ( ) ;
6152
+ write ( varOrConst ) ;
6161
6153
emitModuleMemberName ( namespaceDeclaration ) ;
6162
6154
write ( " = " ) ;
6163
6155
write ( getGeneratedNameForNode ( < ImportDeclaration > node ) ) ;
0 commit comments