@@ -907,6 +907,10 @@ namespace ts {
907907 }
908908 }
909909
910+ export function hasPossibleExternalModuleReference ( node : Node ) : node is AnyImportOrReExport | ModuleDeclaration | ImportTypeNode | ImportCall {
911+ return isAnyImportOrReExport ( node ) || isModuleDeclaration ( node ) || isImportTypeNode ( node ) || isImportCall ( node ) ;
912+ }
913+
910914 export function isAnyImportOrReExport ( node : Node ) : node is AnyImportOrReExport {
911915 return isAnyImportSyntax ( node ) || isExportDeclaration ( node ) ;
912916 }
@@ -2426,7 +2430,7 @@ namespace ts {
24262430 }
24272431 }
24282432
2429- export function getExternalModuleName ( node : AnyImportOrReExport | ImportTypeNode ) : Expression | undefined {
2433+ export function getExternalModuleName ( node : AnyImportOrReExport | ImportTypeNode | ImportCall ) : Expression | undefined {
24302434 switch ( node . kind ) {
24312435 case SyntaxKind . ImportDeclaration :
24322436 case SyntaxKind . ExportDeclaration :
@@ -2435,6 +2439,8 @@ namespace ts {
24352439 return node . moduleReference . kind === SyntaxKind . ExternalModuleReference ? node . moduleReference . expression : undefined ;
24362440 case SyntaxKind . ImportType :
24372441 return isLiteralImportTypeNode ( node ) ? node . argument . literal : undefined ;
2442+ case SyntaxKind . CallExpression :
2443+ return node . arguments [ 0 ] ;
24382444 default :
24392445 return Debug . assertNever ( node ) ;
24402446 }
@@ -3065,14 +3071,7 @@ namespace ts {
30653071 return ! ! originalKeywordKind && ! isContextualKeyword ( originalKeywordKind ) ;
30663072 }
30673073
3068- export type TriviaKind =
3069- SyntaxKind . SingleLineCommentTrivia
3070- | SyntaxKind . MultiLineCommentTrivia
3071- | SyntaxKind . NewLineTrivia
3072- | SyntaxKind . WhitespaceTrivia
3073- | SyntaxKind . ShebangTrivia
3074- | SyntaxKind . ConflictMarkerTrivia ;
3075- export function isTrivia ( token : SyntaxKind ) : token is TriviaKind {
3074+ export function isTrivia ( token : SyntaxKind ) : token is TriviaSyntaxKind {
30763075 return SyntaxKind . FirstTriviaToken <= token && token <= SyntaxKind . LastTriviaToken ;
30773076 }
30783077
@@ -3580,7 +3579,8 @@ namespace ts {
35803579 }
35813580
35823581 // TODO: Should prefix `++` and `--` be moved to the `Update` precedence?
3583- // TODO: We are missing `TypeAssertionExpression`
3582+ case SyntaxKind . TypeAssertionExpression :
3583+ case SyntaxKind . NonNullExpression :
35843584 case SyntaxKind . PrefixUnaryExpression :
35853585 case SyntaxKind . TypeOfExpression :
35863586 case SyntaxKind . VoidExpression :
@@ -3602,6 +3602,9 @@ namespace ts {
36023602 case SyntaxKind . ElementAccessExpression :
36033603 return OperatorPrecedence . Member ;
36043604
3605+ case SyntaxKind . AsExpression :
3606+ return OperatorPrecedence . Relational ;
3607+
36053608 case SyntaxKind . ThisKeyword :
36063609 case SyntaxKind . SuperKeyword :
36073610 case SyntaxKind . Identifier :
0 commit comments