File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -3099,6 +3099,15 @@ namespace ts {
3099
3099
error(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types);
3100
3100
return unknownType;
3101
3101
}
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
+ }
3102
3111
const literalMembers: PropertyName[] = [];
3103
3112
for (const element of pattern.elements) {
3104
3113
if (!(element as BindingElement).dotDotDotToken) {
You can’t perform that action at this time.
0 commit comments