mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Add Support for Using Aliased Discriminants in Conditional Statements (#56173)
This commit is contained in:
1 parent
50f48840a3
commit
7b96c28e8f
6 files changed
+1126
No files matched your search
@@ -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