@@ -2782,8 +2782,9 @@ namespace ts {
2782
2782
case SyntaxKind . SlashToken :
2783
2783
case SyntaxKind . SlashEqualsToken :
2784
2784
case SyntaxKind . Identifier :
2785
- case SyntaxKind . ImportKeyword :
2786
2785
return true ;
2786
+ case SyntaxKind . ImportKeyword :
2787
+ return lookAhead ( nextTokenIsOpenParenOrLessThan ) ;
2787
2788
default :
2788
2789
return isIdentifier ( ) ;
2789
2790
}
@@ -3695,7 +3696,7 @@ namespace ts {
3695
3696
// 3)we have a MemberExpression which either completes the LeftHandSideExpression,
3696
3697
// or starts the beginning of the first four CallExpression productions.
3697
3698
let expression : MemberExpression ;
3698
- if ( token ( ) === SyntaxKind . ImportKeyword && lookAhead ( nextTokenIsOpenParenOrLessThan ) ) {
3699
+ if ( token ( ) === SyntaxKind . ImportKeyword ) {
3699
3700
// We don't want to eagerly consume all import keyword as import call expression so we look a head to find "("
3700
3701
// For example:
3701
3702
// var foo3 = require("subfolder
@@ -4807,9 +4808,11 @@ namespace ts {
4807
4808
// however, we say they are here so that we may gracefully parse them and error later.
4808
4809
case SyntaxKind . CatchKeyword :
4809
4810
case SyntaxKind . FinallyKeyword :
4810
- case SyntaxKind . ImportKeyword :
4811
4811
return true ;
4812
4812
4813
+ case SyntaxKind . ImportKeyword :
4814
+ return isStartOfDeclaration ( ) || lookAhead ( nextTokenIsOpenParenOrLessThan ) ;
4815
+
4813
4816
case SyntaxKind . ConstKeyword :
4814
4817
case SyntaxKind . ExportKeyword :
4815
4818
return isStartOfDeclaration ( ) ;
0 commit comments