Skip to content

Commit 9d5e8fe

Browse files
committed
Continue to error on rest from generic source type
1 parent 0f308f5 commit 9d5e8fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4637,7 +4637,7 @@ namespace ts {
46374637
let type: Type | undefined;
46384638
if (pattern.kind === SyntaxKind.ObjectBindingPattern) {
46394639
if (declaration.dotDotDotToken) {
4640-
if (parentType.flags & TypeFlags.Unknown || !isValidSpreadType(parentType)) {
4640+
if (parentType.flags & TypeFlags.Unknown || !isValidSpreadType(parentType) || isGenericObjectType(parentType)) {
46414641
error(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types);
46424642
return errorType;
46434643
}

0 commit comments

Comments
 (0)