File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3099,6 +3099,15 @@ namespace ts {
30993099 error(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types);
31003100 return unknownType;
31013101 }
3102+ const parent = pattern.parent as VariableLikeDeclaration;
3103+ if (parent.kind === SyntaxKind.Parameter &&
3104+ !parent.type &&
3105+ !parent.initializer &&
3106+ !getContextuallyTypedParameterType(parent as ParameterDeclaration)) {
3107+ // if this type came from examining the structure of the pattern --
3108+ // there was no other information -- then it is not sufficient to determine the rest type, so just return any
3109+ return anyType;
3110+ }
31023111 const literalMembers: PropertyName[] = [];
31033112 for (const element of pattern.elements) {
31043113 if (!(element as BindingElement).dotDotDotToken) {
You can’t perform that action at this time.
0 commit comments