mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 20:37:46 -05:00
Treat array literal contextually typed by homomorphic mapped types as in tuple context (#56555)
This commit is contained in:
committed by
GitHub
parent
b527b9059a
commit
2c7162143b
@@ -31053,7 +31053,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const inDestructuringPattern = isAssignmentTarget(node);
|
||||
const inConstContext = isConstContext(node);
|
||||
const contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
|
||||
const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, isTupleLikeType);
|
||||
const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, t => isTupleLikeType(t) || isGenericMappedType(t) && !t.nameType && !!getHomomorphicTypeVariable(t.target as MappedType || t));
|
||||
|
||||
let hasOmittedExpression = false;
|
||||
for (let i = 0; i < elementCount; i++) {
|
||||
const e = elements[i];
|
||||
|
||||
Reference in New Issue
Block a user