Skip to content

Commit 213812a

Browse files
committed
Contextually type object spread expressions
so `x = { ... { a: "a" } }` will be equivalent to `{ a: "a" }`.
1 parent a0abadb commit 213812a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12728,6 +12728,8 @@ namespace ts {
1272812728
case SyntaxKind.PropertyAssignment:
1272912729
case SyntaxKind.ShorthandPropertyAssignment:
1273012730
return getContextualTypeForObjectLiteralElement(<ObjectLiteralElementLike>parent);
12731+
case SyntaxKind.SpreadAssignment:
12732+
return getApparentTypeOfContextualType(parent.parent as ObjectLiteralExpression);
1273112733
case SyntaxKind.ArrayLiteralExpression:
1273212734
return getContextualTypeForElementExpression(node);
1273312735
case SyntaxKind.ConditionalExpression:

0 commit comments

Comments
 (0)