Continue to error on rest from generic source type

This commit is contained in:
Anders Hejlsberg
2018-10-30 16:00:05 -07:00
parent 0f308f5074
commit 9d5e8fe89f

View File

@@ -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;
}