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 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;