mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-26 20:14:05 -05:00
CFA for dependent parameters typed by generic constraints (#48411)
* Obtain apparent type in parameter destructuring check * Add regression test
This commit is contained in:
@@ -25450,7 +25450,7 @@ namespace ts {
|
||||
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
||||
const contextualSignature = getContextualSignature(func);
|
||||
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
||||
const restType = getTypeOfSymbol(contextualSignature.parameters[0]);
|
||||
const restType = getReducedApparentType(getTypeOfSymbol(contextualSignature.parameters[0]));
|
||||
if (restType.flags & TypeFlags.Union && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
|
||||
const narrowedType = getFlowTypeOfReference(func, restType, restType, /*flowContainer*/ undefined, location.flowNode);
|
||||
const index = func.parameters.indexOf(declaration) - (getThisParameter(func) ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user