<p dir="auto">The generated code for</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="type NameOrNameArray = string | string[];

function createName(name) {
    if (typeof name === &quot;string&quot;) {
        return name;
    } else if (typeof name == 'number') {
        return name.toString();
    } else {
        return name.join(&quot; &quot;);
    } 
}

var greetingMessage = `Greetings, ${createName(3213) }`;
alert(greetingMessage);"><pre class="notranslate"><code class="notranslate">type NameOrNameArray = string | string[];

function createName(name) {
    if (typeof name === "string") {
        return name;
    } else if (typeof name == 'number') {
        return name.toString();
    } else {
        return name.join(" ");
    } 
}

var greetingMessage = `Greetings, ${createName(3213) }`;
alert(greetingMessage);
</code></pre></div>
<p dir="auto">is</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function createName(name) {
    if (typeof name === &quot;string&quot;) {
        return name;
    }
    else if (typeof name == 'number') {
        return name.toString();
    }
    else {
        return name.join(&quot; &quot;);
    }
}"><pre class="notranslate"><code class="notranslate">function createName(name) {
    if (typeof name === "string") {
        return name;
    }
    else if (typeof name == 'number') {
        return name.toString();
    }
    else {
        return name.join(" ");
    }
}
</code></pre></div>
<p dir="auto">the else after } should not newline.</p>
<p dir="auto">I know many users of TypeScript are from a C# background and expect to write conditionals like in that language. However, for JavaScript developers the standard for formatting conditionals is different. When TypeScript converts conditionals to JavaScript, it outputs the <code class="notranslate">else</code> and <code class="notranslate">else if</code> statements like so:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="}
else if(whatever) {
}
else {
}"><pre class="notranslate"><code class="notranslate">}
else if(whatever) {
}
else {
}
</code></pre></div>
<p dir="auto">The normal JavaScript format is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="} else if (whatever) {
} else {
}"><pre class="notranslate"><code class="notranslate">} else if (whatever) {
} else {
}
</code></pre></div>
<p dir="auto">Most teams have coding rules and code review mechanisms in place to make sure these conventions are followed. For a reference on standard JavaScript formatting conventions, please consult Douglas Crockford's guide: <a href="http://javascript.crockford.com/code.html" rel="nofollow">http://javascript.crockford.com/code.html</a>. About half way down you'll find the convention for conditionals.</p>
<p dir="auto">At very least it would be nice to have a flag that we could set to get the expected formatting instead of the C/C# style you are currently producing.</p>