Skip to content

Indentation removed in JavaScript output for JSX (minor) #1791

@dragomirtitian

Description

@dragomirtitian

Steps to reproduce

import * as React from 'react'
declare function Child(props: { children?: React.ReactNode }): React.ReactNode;
function Test() {
    return <Child>
        <Child>
            <Child></Child>
        </Child>
    </Child>
}

Behavior with [email protected]

The output preserves the newlines and indentation of the tags:

function Test() {
    return React.createElement(Child, null,
        React.createElement(Child, null,
            React.createElement(Child, null)));
}

Behavior with tsgo

The output collapses everything on a single line:

function Test() {
    return React.createElement(Child, null, React.createElement(Child, null, React.createElement(Child, null)));
}

Metadata

Metadata

Assignees

Labels

Domain: EmitRelated to emit, AST printing, Program emit funcs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions