@@ -223,6 +223,7 @@ import {
223
223
isGeneratedIdentifier ,
224
224
isGeneratedPrivateIdentifier ,
225
225
isIdentifier ,
226
+ isImportAttributes ,
226
227
isIncrementalCompilation ,
227
228
isInJsonFile ,
228
229
isInternalDeclaration ,
@@ -1840,6 +1841,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
1840
1841
if ( hint === EmitHint . IdentifierName ) return emitIdentifier ( cast ( node , isIdentifier ) ) ;
1841
1842
if ( hint === EmitHint . JsxAttributeValue ) return emitLiteral ( cast ( node , isStringLiteral ) , /*jsxAttributeEscape*/ true ) ;
1842
1843
if ( hint === EmitHint . MappedTypeParameter ) return emitMappedTypeParameter ( cast ( node , isTypeParameterDeclaration ) ) ;
1844
+ if ( hint === EmitHint . ImportTypeNodeAttributes ) return emitImportTypeNodeAttributes ( cast ( node , isImportAttributes ) ) ;
1843
1845
if ( hint === EmitHint . EmbeddedStatement ) {
1844
1846
Debug . assertNode ( node , isEmptyStatement ) ;
1845
1847
return emitEmptyStatement ( /*isEmbeddedStatement*/ true ) ;
@@ -2944,15 +2946,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
2944
2946
if ( node . attributes ) {
2945
2947
writePunctuation ( "," ) ;
2946
2948
writeSpace ( ) ;
2947
- writePunctuation ( "{" ) ;
2948
- writeSpace ( ) ;
2949
- writeKeyword ( node . attributes . token === SyntaxKind . AssertKeyword ? "assert" : "with" ) ;
2950
- writePunctuation ( ":" ) ;
2951
- writeSpace ( ) ;
2952
- const elements = node . attributes . elements ;
2953
- emitList ( node . attributes , elements , ListFormat . ImportAttributes ) ;
2954
- writeSpace ( ) ;
2955
- writePunctuation ( "}" ) ;
2949
+ pipelineEmit ( EmitHint . ImportTypeNodeAttributes , node . attributes ) ;
2956
2950
}
2957
2951
writePunctuation ( ")" ) ;
2958
2952
if ( node . qualifier ) {
@@ -4077,6 +4071,18 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
4077
4071
writeTrailingSemicolon ( ) ;
4078
4072
}
4079
4073
4074
+ function emitImportTypeNodeAttributes ( node : ImportAttributes ) {
4075
+ writePunctuation ( "{" ) ;
4076
+ writeSpace ( ) ;
4077
+ writeKeyword ( node . token === SyntaxKind . AssertKeyword ? "assert" : "with" ) ;
4078
+ writePunctuation ( ":" ) ;
4079
+ writeSpace ( ) ;
4080
+ const elements = node . elements ;
4081
+ emitList ( node , elements , ListFormat . ImportAttributes ) ;
4082
+ writeSpace ( ) ;
4083
+ writePunctuation ( "}" ) ;
4084
+ }
4085
+
4080
4086
function emitImportAttributes ( node : ImportAttributes ) {
4081
4087
emitTokenWithComment ( node . token , node . pos , writeKeyword , node ) ;
4082
4088
writeSpace ( ) ;
0 commit comments