-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
I'd expect createPrinter.printFile() to format the file, but not remove the empty lines inside the file. Empty lines are meaningful, because the developers often use an empty line to structure the code into identifiable blocks. For example, to separate the import declarations from the rest of the file.
TypeScript Version: 2.7.0-dev.20171206
Code
import { createPrinter, createSourceFile, ScriptTarget, NewLineKind } from 'typescript';
import * as fs from 'fs';
const file = createSourceFile('./output.ts', `
import {smth} from 'dfsdf';
import {smth2} from 'dfsdf2';
foo();
`, ScriptTarget.Latest);
fs.writeFileSync(file.fileName, createPrinter().printFile(file));Expected behavior:
output.ts should contain given text:
import { smth } from "dfsdf";
import { smth2 } from "dfsdf2";
foo();
Actual behavior:
output.ts contains given text:
import { smth } from "dfsdf";
import { smth2 } from "dfsdf2";
foo();
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code