From 213812ab22ee7773e067db02557d5db6576baf2e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 24 Apr 2017 15:43:10 -0700 Subject: [PATCH] Contextually type object spread expressions so `x = { ... { a: "a" } }` will be equivalent to `{ a: "a" }`. --- src/compiler/checker.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 57e9d02ddd8..8471ba7aa1f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12728,6 +12728,8 @@ namespace ts { case SyntaxKind.PropertyAssignment: case SyntaxKind.ShorthandPropertyAssignment: return getContextualTypeForObjectLiteralElement(parent); + case SyntaxKind.SpreadAssignment: + return getApparentTypeOfContextualType(parent.parent as ObjectLiteralExpression); case SyntaxKind.ArrayLiteralExpression: return getContextualTypeForElementExpression(node); case SyntaxKind.ConditionalExpression: