Skip to content

Commit 9e9054b

Browse files
author
Arthur Ozga
committed
handle todo
1 parent a32bc98 commit 9e9054b

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2555,7 +2555,7 @@ namespace ts {
25552555
const resolved = resolveStructuredTypeMembers(type);
25562556
if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
25572557
if (!resolved.callSignatures.length && !resolved.constructSignatures.length) {
2558-
return createTypeLiteralNode(/*members*/ undefined);
2558+
return setEmitFlags(createTypeLiteralNode(/*members*/ undefined), EmitFlags.SingleLine);
25592559
}
25602560

25612561
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {

src/compiler/emitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ namespace ts {
961961

962962
function emitTypeLiteral(node: TypeLiteralNode) {
963963
write("{");
964-
// TODO: fix added indentation so we can remove this check.
964+
// If the literal is empty, do not add spaces between braces.
965965
if (node.members.length > 0) {
966966
emitList(node, node.members, getEmitFlags(node) & EmitFlags.SingleLine ? ListFormat.SingleLineTypeLiteralMembers : ListFormat.MultiLineTypeLiteralMembers);
967967
}

src/compiler/factory.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3294,16 +3294,6 @@ namespace ts {
32943294
return statements;
32953295
}
32963296

3297-
export function parenthesizeConditionalHead(condition: Expression) {
3298-
const conditionalPrecedence = getOperatorPrecedence(SyntaxKind.ConditionalExpression, SyntaxKind.QuestionToken);
3299-
const emittedCondition = skipPartiallyEmittedExpressions(condition);
3300-
const conditionPrecedence = getExpressionPrecedence(emittedCondition);
3301-
if (compareValues(conditionPrecedence, conditionalPrecedence) === Comparison.LessThan) {
3302-
return createParen(condition);
3303-
}
3304-
return condition;
3305-
}
3306-
33073297
/**
33083298
* Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended
33093299
* order of operations.
@@ -3605,6 +3595,8 @@ namespace ts {
36053595
return expression;
36063596
}
36073597

3598+
function parenthesizeElementTypeMembers() {}
3599+
36083600
/**
36093601
* Clones a series of not-emitted expressions with a new inner expression.
36103602
*

0 commit comments

Comments
 (0)