From 9d5e8fe89f0063a0eb70034c3314f6e903003e4e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 30 Oct 2018 16:00:05 -0700 Subject: [PATCH] Continue to error on rest from generic source type --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2a27a7a7e8a..23cb632b2b1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4637,7 +4637,7 @@ namespace ts { let type: Type | undefined; if (pattern.kind === SyntaxKind.ObjectBindingPattern) { if (declaration.dotDotDotToken) { - if (parentType.flags & TypeFlags.Unknown || !isValidSpreadType(parentType)) { + if (parentType.flags & TypeFlags.Unknown || !isValidSpreadType(parentType) || isGenericObjectType(parentType)) { error(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types); return errorType; }