UNPKG

445 BPlain TextView Raw
1import { ts } from 'ts-simple-ast';
2
3export class TsPrinterUtil {
4 private printer: ts.Printer;
5
6 constructor() {
7 this.printer = ts.createPrinter({
8 newLine: ts.NewLineKind.LineFeed
9 });
10 }
11
12 public print(node: ts.Node): string {
13 return this.printer.printNode(
14 ts.EmitHint.Unspecified,
15 node,
16 ts.createSourceFile('', '', ts.ScriptTarget.Latest)
17 );
18 }
19}