Emit does not preserve empty lines
See original GitHub issueHi,
TS Version: 1.1
Given
function foo() {
var x = 10;
var y = 11;
}
We used to get
function foo() {
var x = 10;
var y = 11;
}
In the new compiler the line break is missing
function foo() {
var x = 10;
var y = 11;
}
(Both compilers removed the first empty line, but the new compiler has gone a step further.)
This can affect the experience when debugging JavaScript in the browser.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:67
- Comments:41 (8 by maintainers)
Top Results From Across the Web
Removing all blank lines but not comments in Ruamel.yaml
The earlier versions of ruamel.yaml would not preserve empty lines, it is however relatively easy to get that behaviour back by stripping ...
Read more >Issue 17113: argparse.RawDescriptionHelpFormatter should ...
A user could preserve blank lines by including a space (or more) in each. That is, instead of ending with '\n', end with...
Read more >Possible to preserve empty lines (whitespace) on conversion ...
Is it possible to preserve blank lines between paragraphs when converting from markdown to docx? I'd rather have an actual blank line for...
Read more >Angular compiler options
Set to true to preserve blank text nodes. skipMetadataEmit link. When true , does not produce .metadata.json files. Default is false .
Read more >YAML Ain't Markup Language (YAML™) revision 1.2.2
There are no normative changes from the YAML specification v1.2. ... 2.15 Folded newlines are preserved for “more indented” and blank lines
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The crowd wants
preserveWhitespace: true/false
@ORESoftware ++I would also like this for a similar reason as @timjmartel - when developers see the emitted JS looks nice they are less resistant to adopt. Preserving (at least vertical) whitespace makes the code look less like it was generated by a machine and more like idomatic JS code written by a human.
If our team ever decided to abandon TS and instead continue with the transpiled JS it would be much easier to adopt the emitted JS sources if they had human-friendly whitespace.