Skip to content

Commit d61a14b

Browse files
committed
Remove Literal type assertion from getS3SignedUrlApiNames
1 parent 99db636 commit d61a14b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Collection, JSCodeshift, Literal } from "jscodeshift";
1+
import type { Collection, JSCodeshift } from "jscodeshift";
22

33
import type { ClientIdentifier } from "../types";
44

@@ -20,7 +20,14 @@ export const getS3SignedUrlApiNames = (
2020
},
2121
})
2222
.forEach((callExpression) => {
23-
apiNames.add((callExpression.value.arguments[0] as Literal).value as string);
23+
const callExpressionArg = callExpression.value.arguments[0];
24+
if (callExpressionArg.type !== "Literal" && callExpressionArg.type !== "StringLiteral") {
25+
return;
26+
}
27+
if (typeof callExpressionArg.value !== "string") {
28+
return;
29+
}
30+
apiNames.add(callExpressionArg.value);
2431
});
2532
}
2633
}

0 commit comments

Comments
 (0)