From 79d9a134222b2f7a517ce880d4411452da5e09ea Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Thu, 8 Aug 2024 09:05:19 -0700 Subject: [PATCH] Remove type assertion for TryStatement --- src/transforms/v2-to-v3/apis/renameErrorCodeWithName.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/transforms/v2-to-v3/apis/renameErrorCodeWithName.ts b/src/transforms/v2-to-v3/apis/renameErrorCodeWithName.ts index 8492903dd..cd21fb4e1 100644 --- a/src/transforms/v2-to-v3/apis/renameErrorCodeWithName.ts +++ b/src/transforms/v2-to-v3/apis/renameErrorCodeWithName.ts @@ -5,7 +5,6 @@ import type { Collection, FunctionExpression, JSCodeshift, - TryStatement, } from "jscodeshift"; import type { ClientIdentifier } from "../types"; @@ -59,7 +58,7 @@ export const renameErrorCodeWithName = ( // Replace error.code with error.name in try-catch clauses. callExpressions.forEach((callExpression) => { - const tryStatement = j(callExpression).closest(j.TryStatement).nodes()[0] as TryStatement; + const tryStatement = j(callExpression).closest(j.TryStatement).nodes()[0]; if (!tryStatement || !tryStatement.handler) { return;