Do not reset control flow analysis on index signatures (#48427)

* do not flag index signatures as a control flow container

* add tests and baselines
This commit is contained in:
jihndai
2022-04-07 16:29:07 -04:00
committed by GitHub
parent b975dfa102
commit b18141b0bc
6 changed files with 251 additions and 1 deletions

View File

@@ -1818,6 +1818,7 @@ namespace ts {
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.MappedType:
case SyntaxKind.IndexSignature:
return ContainerFlags.IsContainer | ContainerFlags.HasLocals;
case SyntaxKind.SourceFile:
@@ -1838,7 +1839,6 @@ namespace ts {
case SyntaxKind.JSDocFunctionType:
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructSignature:
case SyntaxKind.IndexSignature:
case SyntaxKind.ConstructorType:
case SyntaxKind.ClassStaticBlockDeclaration:
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike;