We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f308f5 commit 9d5e8feCopy full SHA for 9d5e8fe
src/compiler/checker.ts
@@ -4637,7 +4637,7 @@ namespace ts {
4637
let type: Type | undefined;
4638
if (pattern.kind === SyntaxKind.ObjectBindingPattern) {
4639
if (declaration.dotDotDotToken) {
4640
- if (parentType.flags & TypeFlags.Unknown || !isValidSpreadType(parentType)) {
+ if (parentType.flags & TypeFlags.Unknown || !isValidSpreadType(parentType) || isGenericObjectType(parentType)) {
4641
error(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types);
4642
return errorType;
4643
}
0 commit comments