Skip to content

Commit 49ff721

Browse files
authored
Remove type assertion for TryStatement (#931)
1 parent 07e2379 commit 49ff721

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.changeset/spotty-cycles-bow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"aws-sdk-js-codemod": patch
3+
---
4+
5+
Remove type assertion for TryStatement

src/transforms/v2-to-v3/apis/renameErrorCodeWithName.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type {
55
Collection,
66
FunctionExpression,
77
JSCodeshift,
8-
TryStatement,
98
} from "jscodeshift";
109

1110
import type { ClientIdentifier } from "../types";
@@ -59,7 +58,7 @@ export const renameErrorCodeWithName = (
5958

6059
// Replace error.code with error.name in try-catch clauses.
6160
callExpressions.forEach((callExpression) => {
62-
const tryStatement = j(callExpression).closest(j.TryStatement).nodes()[0] as TryStatement;
61+
const tryStatement = j(callExpression).closest(j.TryStatement).nodes()[0];
6362

6463
if (!tryStatement || !tryStatement.handler) {
6564
return;

0 commit comments

Comments
 (0)