mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add Support for Using Aliased Discriminants in Conditional Statements (#56173)
This commit is contained in:
@@ -27244,6 +27244,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
// The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here.
|
||||
return isConstantReference((node as AccessExpression).expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol);
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
const rootDeclaration = getRootDeclaration(node.parent);
|
||||
return isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user