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 1/2] 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; From 73cf67b87ae38340e1b93850326ebf712fccf27d Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Thu, 8 Aug 2024 09:05:40 -0700 Subject: [PATCH 2/2] chore: yarn changeset --- .changeset/spotty-cycles-bow.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spotty-cycles-bow.md diff --git a/.changeset/spotty-cycles-bow.md b/.changeset/spotty-cycles-bow.md new file mode 100644 index 000000000..6b3cc7844 --- /dev/null +++ b/.changeset/spotty-cycles-bow.md @@ -0,0 +1,5 @@ +--- +"aws-sdk-js-codemod": patch +--- + +Remove type assertion for TryStatement