Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spotty-cycles-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aws-sdk-js-codemod": patch
---

Remove type assertion for TryStatement
3 changes: 1 addition & 2 deletions src/transforms/v2-to-v3/apis/renameErrorCodeWithName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type {
Collection,
FunctionExpression,
JSCodeshift,
TryStatement,
} from "jscodeshift";

import type { ClientIdentifier } from "../types";
Expand Down Expand Up @@ -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;
Expand Down