File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2153,7 +2153,16 @@ module ts {
2153
2153
hasSpreadElement = true;
2154
2154
}
2155
2155
});
2156
- return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes);
2156
+ if (!elementTypes.length) {
2157
+ return languageVersion >= ScriptTarget.ES6 ? createIterableType(anyType) : anyArrayType;
2158
+ }
2159
+ else if (hasSpreadElement) {
2160
+ var unionOfElements = getUnionType(elementTypes);
2161
+ return languageVersion >= ScriptTarget.ES6 ? createIterableType(unionOfElements) : createArrayType(unionOfElements);
2162
+ }
2163
+
2164
+ // If the pattern has at least one element, and no rest element, then it should imply a tuple type.
2165
+ return createTupleType(elementTypes);
2157
2166
}
2158
2167
2159
2168
// Return the type implied by a binding pattern. This is the type implied purely by the binding pattern itself
You can’t perform that action at this time.
0 commit comments