Fixed array expression spreads into variadic const calls (#52845)

This commit is contained in:
Mateusz Burzyński
2023-03-08 23:45:58 +01:00
committed by GitHub
parent 615a97b1d4
commit d681520a14
25 changed files with 467 additions and 152 deletions

View File

@@ -29712,9 +29712,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const elementFlags: ElementFlags[] = [];
pushCachedContextualType(node);
const inDestructuringPattern = isAssignmentTarget(node);
const inConstContext = isConstContext(node);
const isSpreadIntoCallOrNew = isSpreadElement(node.parent) && isCallOrNewExpression(node.parent.parent);
const inConstContext = isSpreadIntoCallOrNew || isConstContext(node);
const contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
const inTupleContext = !!contextualType && someType(contextualType, isTupleLikeType);
const inTupleContext = isSpreadIntoCallOrNew || !!contextualType && someType(contextualType, isTupleLikeType);
let hasOmittedExpression = false;
for (let i = 0; i < elementCount; i++) {
const e = elements[i];