@@ -1146,7 +1146,7 @@ namespace ts {
1146
1146
if ( token === SyntaxKind . DefaultKeyword ) {
1147
1147
return lookAhead ( nextTokenIsClassOrFunction ) ;
1148
1148
}
1149
- return token !== SyntaxKind . AsteriskToken && token !== SyntaxKind . OpenBraceToken && canFollowModifier ( ) ;
1149
+ return token !== SyntaxKind . AsteriskToken && token !== SyntaxKind . AsKeyword && token !== SyntaxKind . OpenBraceToken && canFollowModifier ( ) ;
1150
1150
}
1151
1151
if ( token === SyntaxKind . DefaultKeyword ) {
1152
1152
return nextTokenIsClassOrFunction ( ) ;
@@ -4431,7 +4431,8 @@ namespace ts {
4431
4431
case SyntaxKind . ExportKeyword :
4432
4432
nextToken ( ) ;
4433
4433
if ( token === SyntaxKind . EqualsToken || token === SyntaxKind . AsteriskToken ||
4434
- token === SyntaxKind . OpenBraceToken || token === SyntaxKind . DefaultKeyword ) {
4434
+ token === SyntaxKind . OpenBraceToken || token === SyntaxKind . DefaultKeyword ||
4435
+ token === SyntaxKind . AsKeyword ) {
4435
4436
return true ;
4436
4437
}
4437
4438
continue ;
@@ -4608,22 +4609,23 @@ namespace ts {
4608
4609
case SyntaxKind . EnumKeyword :
4609
4610
return parseEnumDeclaration ( fullStart , decorators , modifiers ) ;
4610
4611
case SyntaxKind . GlobalKeyword :
4611
- if ( lookAhead ( isGlobalModuleExportDeclaration ) ) {
4612
- return parseGlobalModuleExportDeclaration ( fullStart , decorators , modifiers ) ;
4613
- }
4614
- else {
4615
- return parseModuleDeclaration ( fullStart , decorators , modifiers ) ;
4616
- }
4612
+ return parseModuleDeclaration ( fullStart , decorators , modifiers ) ;
4617
4613
case SyntaxKind . ModuleKeyword :
4618
4614
case SyntaxKind . NamespaceKeyword :
4619
4615
return parseModuleDeclaration ( fullStart , decorators , modifiers ) ;
4620
4616
case SyntaxKind . ImportKeyword :
4621
4617
return parseImportDeclarationOrImportEqualsDeclaration ( fullStart , decorators , modifiers ) ;
4622
4618
case SyntaxKind . ExportKeyword :
4623
4619
nextToken ( ) ;
4624
- return token === SyntaxKind . DefaultKeyword || token === SyntaxKind . EqualsToken ?
4625
- parseExportAssignment ( fullStart , decorators , modifiers ) :
4626
- parseExportDeclaration ( fullStart , decorators , modifiers ) ;
4620
+ switch ( token ) {
4621
+ case SyntaxKind . DefaultKeyword :
4622
+ case SyntaxKind . EqualsToken :
4623
+ return parseExportAssignment ( fullStart , decorators , modifiers ) ;
4624
+ case SyntaxKind . AsKeyword :
4625
+ return parseGlobalModuleExportDeclaration ( fullStart , decorators , modifiers ) ;
4626
+ default :
4627
+ return parseExportDeclaration ( fullStart , decorators , modifiers ) ;
4628
+ }
4627
4629
default :
4628
4630
if ( decorators || modifiers ) {
4629
4631
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
@@ -4637,11 +4639,6 @@ namespace ts {
4637
4639
}
4638
4640
}
4639
4641
4640
- function isGlobalModuleExportDeclaration ( ) {
4641
- nextToken ( ) ;
4642
- return token === SyntaxKind . ExportKeyword ;
4643
- }
4644
-
4645
4642
function nextTokenIsIdentifierOrStringLiteralOnSameLine ( ) {
4646
4643
nextToken ( ) ;
4647
4644
return ! scanner . hasPrecedingLineBreak ( ) && ( isIdentifier ( ) || token === SyntaxKind . StringLiteral ) ;
@@ -5301,8 +5298,8 @@ namespace ts {
5301
5298
const exportDeclaration = < GlobalModuleExportDeclaration > createNode ( SyntaxKind . GlobalModuleExportDeclaration , fullStart ) ;
5302
5299
exportDeclaration . decorators = decorators ;
5303
5300
exportDeclaration . modifiers = modifiers ;
5304
- parseExpected ( SyntaxKind . GlobalKeyword ) ;
5305
- parseExpected ( SyntaxKind . ExportKeyword ) ;
5301
+ parseExpected ( SyntaxKind . AsKeyword ) ;
5302
+ parseExpected ( SyntaxKind . NamespaceKeyword ) ;
5306
5303
5307
5304
exportDeclaration . name = parseIdentifier ( ) ;
5308
5305
0 commit comments