mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 20:37:46 -05:00
Fixed narrowing based on aliased discriminants coming from destructured parameters (#56860)
This commit is contained in:
committed by
GitHub
parent
01a51d2d01
commit
5a355093bb
@@ -476,6 +476,7 @@ import {
|
||||
isCallOrNewExpression,
|
||||
isCallSignatureDeclaration,
|
||||
isCatchClause,
|
||||
isCatchClauseVariableDeclaration,
|
||||
isCatchClauseVariableDeclarationOrBindingElement,
|
||||
isCheckJsEnabledForFile,
|
||||
isClassDeclaration,
|
||||
@@ -27490,7 +27491,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
const rootDeclaration = getRootDeclaration(node.parent);
|
||||
return isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
|
||||
return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration)
|
||||
? !isSomeSymbolAssigned(rootDeclaration)
|
||||
: isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user