Skip to content

Commit c7a4c13

Browse files
committed
Return early
1 parent 6a21dd6 commit c7a4c13

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10205,15 +10205,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1020510205
const isOptional = includeOptionality && isOptionalDeclaration(declaration);
1020610206

1020710207
// Use type from type annotation if one is present
10208-
let declaredType = tryGetTypeFromEffectiveTypeNode(declaration);
10208+
const declaredType = tryGetTypeFromEffectiveTypeNode(declaration);
1020910209
if (isCatchClauseVariableDeclarationOrBindingElement(declaration)) {
1021010210
if (declaredType) {
1021110211
// If the catch clause is explicitly annotated with any or unknown, accept it, otherwise error.
1021210212
return isTypeAny(declaredType) || declaredType === unknownType ? declaredType : errorType;
1021310213
}
1021410214
// If the catch clause is not explicitly annotated, treat it as though it were explicitly
1021510215
// annotated with unknown or any, depending on useUnknownInCatchVariables.
10216-
declaredType = useUnknownInCatchVariables ? unknownType : anyType;
10216+
return useUnknownInCatchVariables ? unknownType : anyType;
1021710217
}
1021810218
if (declaredType) {
1021910219
return addOptionality(declaredType, isProperty, isOptional);

0 commit comments

Comments
 (0)