@@ -2782,8 +2782,9 @@ namespace ts {
27822782 case SyntaxKind . SlashToken :
27832783 case SyntaxKind . SlashEqualsToken :
27842784 case SyntaxKind . Identifier :
2785- case SyntaxKind . ImportKeyword :
27862785 return true ;
2786+ case SyntaxKind . ImportKeyword :
2787+ return lookAhead ( nextTokenIsOpenParenOrLessThan ) ;
27872788 default :
27882789 return isIdentifier ( ) ;
27892790 }
@@ -3695,7 +3696,7 @@ namespace ts {
36953696 // 3)we have a MemberExpression which either completes the LeftHandSideExpression,
36963697 // or starts the beginning of the first four CallExpression productions.
36973698 let expression : MemberExpression ;
3698- if ( token ( ) === SyntaxKind . ImportKeyword && lookAhead ( nextTokenIsOpenParenOrLessThan ) ) {
3699+ if ( token ( ) === SyntaxKind . ImportKeyword ) {
36993700 // We don't want to eagerly consume all import keyword as import call expression so we look a head to find "("
37003701 // For example:
37013702 // var foo3 = require("subfolder
@@ -4807,9 +4808,11 @@ namespace ts {
48074808 // however, we say they are here so that we may gracefully parse them and error later.
48084809 case SyntaxKind . CatchKeyword :
48094810 case SyntaxKind . FinallyKeyword :
4810- case SyntaxKind . ImportKeyword :
48114811 return true ;
48124812
4813+ case SyntaxKind . ImportKeyword :
4814+ return isStartOfDeclaration ( ) || lookAhead ( nextTokenIsOpenParenOrLessThan ) ;
4815+
48134816 case SyntaxKind . ConstKeyword :
48144817 case SyntaxKind . ExportKeyword :
48154818 return isStartOfDeclaration ( ) ;
0 commit comments