Compiler API Typescript. Multiline NamedImports

Try to do a multiline NamedImports. My code: const importClause = factory?.createImportClause( Boolean(node.importClause?.isTypeOnly), node.importClause?.name, factory?.createNamedImports(uniqImports as ImportSpecifier[]), ); const importProps: ts.ImportDeclaration = factory?.createImportDeclaration( node.decorators, node.modifiers, importClause, node.moduleSpecifier, node.assertClause, ); my result: import { One, Two } from ‘something’; expected result: import { One, Two, } from ‘something’; What should I do? >Solution : The printer… Read More Compiler API Typescript. Multiline NamedImports

How to ignore jsDoc while generating code using printNode function from Typescript compiler api?

Typescript compiler API allows us to process abstract syntax tree (AST) and generate source code. We can do it by creating a printer object and using printNode function const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); printer.printNode(ts.EmitHint.Unspecified, node, sourceFile)) The problem I’m facing is that my AST contains lots of jsDoc in various places and I… Read More How to ignore jsDoc while generating code using printNode function from Typescript compiler api?