@@ -27074,6 +27074,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
27074
27074
isFunctionLike(node) && !getImmediatelyInvokedFunctionExpression(node) ||
27075
27075
node.kind === SyntaxKind.ModuleBlock ||
27076
27076
node.kind === SyntaxKind.SourceFile ||
27077
+ node.kind === SyntaxKind.CatchClause ||
27077
27078
node.kind === SyntaxKind.PropertyDeclaration)!;
27078
27079
}
27079
27080
@@ -27446,6 +27447,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
27446
27447
const isParameter = getRootDeclaration(declaration).kind === SyntaxKind.Parameter;
27447
27448
const declarationContainer = getControlFlowContainer(declaration);
27448
27449
let flowContainer = getControlFlowContainer(node);
27450
+ const isCatch = flowContainer.kind === SyntaxKind.CatchClause;
27449
27451
const isOuterVariable = flowContainer !== declarationContainer;
27450
27452
const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
27451
27453
const isModuleExports = symbol.flags & SymbolFlags.ModuleExports;
@@ -27460,7 +27462,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
27460
27462
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
27461
27463
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
27462
27464
// declaration container are the same).
27463
- const assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
27465
+ const assumeInitialized = isParameter || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
27464
27466
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (TypeFlags.AnyOrUnknown | TypeFlags.Void)) !== 0 ||
27465
27467
isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === SyntaxKind.ExportSpecifier) ||
27466
27468
node.parent.kind === SyntaxKind.NonNullExpression ||
0 commit comments