mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Stop looking at control flow containers for this
References to `this` should not continue looking outside their immediate container to narrow. Introduced by #11458, which allows narrowing of captured variables inside methods of class expressions.
This commit is contained in:
@@ -11009,7 +11009,7 @@ namespace ts {
|
||||
else if (flow.flags & FlowFlags.Start) {
|
||||
// Check if we should continue with the control flow of the containing function.
|
||||
const container = (<FlowStart>flow).container;
|
||||
if (container && container !== flowContainer && reference.kind !== SyntaxKind.PropertyAccessExpression) {
|
||||
if (container && container !== flowContainer && reference.kind !== SyntaxKind.PropertyAccessExpression && reference.kind !== SyntaxKind.ThisKeyword) {
|
||||
flow = container.flowNode;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user