File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
tests/baselines/reference Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1891,7 +1891,10 @@ module ts {
1891
1891
}
1892
1892
1893
1893
// If this node is in external module, check if this is export assigned
1894
- if ( getContainerOfModuleElementDeclaration ( node ) . flags & NodeFlags . ExternalModule ) {
1894
+ var moduleDeclaration = getContainerOfModuleElementDeclaration ( node ) ;
1895
+ if ( ( moduleDeclaration . flags & NodeFlags . ExternalModule ) || // Source file with external module flag
1896
+ // Ambient external module declaration
1897
+ ( moduleDeclaration . kind === SyntaxKind . ModuleDeclaration && ( < ModuleDeclaration > moduleDeclaration ) . name . kind === SyntaxKind . StringLiteral ) ) {
1895
1898
return resolver . isReferencedInExportAssignment ( node ) ;
1896
1899
}
1897
1900
@@ -2083,6 +2086,7 @@ module ts {
2083
2086
}
2084
2087
2085
2088
function emitVariableDeclaration ( node : VariableDeclaration ) {
2089
+ // If we are emitting property it isnt moduleElement and doesnt need canEmitModuleElement check
2086
2090
if ( node . kind !== SyntaxKind . VariableDeclaration || canEmitModuleElementDeclaration ( node ) ) {
2087
2091
emitSourceTextOfNode ( node . name ) ;
2088
2092
// If optional property emit ?
Original file line number Diff line number Diff line change @@ -275,7 +275,8 @@ module ts {
275
275
276
276
export function getContainerOfModuleElementDeclaration ( node : Declaration ) {
277
277
// If the declaration is var declaration, then the parent is variable statement but we actually want the module
278
- return node . kind === SyntaxKind . VariableDeclaration ? node . parent . parent : node . parent ;
278
+ var container = node . kind === SyntaxKind . VariableDeclaration ? node . parent . parent : node . parent ;
279
+ return container . kind == SyntaxKind . ModuleBlock ? container . parent : container ;
279
280
}
280
281
281
282
enum ParsingContext {
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ module.exports = MainModule;
35
35
36
36
//// [missingImportAfterModuleImport_0.d.ts]
37
37
declare module "SubModule" {
38
+ class SubModule {
39
+ static StaticVar ;
40
+ InstanceVar ;
41
+ constructor ( ) ;
42
+ }
38
43
export = SubModule ;
39
44
}
40
45
//// [missingImportAfterModuleImport_1.d.ts]
You can’t perform that action at this time.
0 commit comments