Skip to content

Commit

Permalink
Remove type annotation transformation in redundant types (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Oct 18, 2023
1 parent bf44354 commit 0296d75
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 38 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-rats-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aws-sdk-js-codemod": patch
---

Remove type annotation transformation in redundant types
9 changes: 4 additions & 5 deletions src/transforms/v2-to-v3/ts-type/replaceTSQualifiedName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DOCUMENT_CLIENT, DYNAMODB, DYNAMODB_DOCUMENT_CLIENT } from "../config";
import { getClientTypeNames } from "./getClientTypeNames";
import { getTSQualifiedNameFromClientName } from "./getTSQualifiedNameFromClientName";
import { getV3ClientType } from "./getV3ClientType";
import { updateV2ClientType } from "./updateV2ClientType";

export interface ReplaceTSQualifiedNameOptions {
v2ClientName: string;
Expand Down Expand Up @@ -45,9 +44,9 @@ export const replaceTSQualifiedName = (
(v2ClientType) =>
isRightSectionIdentifier(v2ClientType.node) && !isParentTSQualifiedName(v2ClientType)
)
.forEach((v2ClientType) => {
.replaceWith((v2ClientType) => {
const v2ClientTypeName = getRightIdentifierName(v2ClientType.node);
updateV2ClientType(j, v2ClientType, { ...clientTypeOptions, v2ClientTypeName });
return getV3ClientType(j, { ...clientTypeOptions, v2ClientTypeName });
});
}

Expand All @@ -68,9 +67,9 @@ export const replaceTSQualifiedName = (
(v2ClientType) =>
isRightSectionIdentifier(v2ClientType.node) && !isParentTSQualifiedName(v2ClientType)
)
.forEach((v2ClientType) => {
.replaceWith((v2ClientType) => {
const v2ClientTypeName = getRightIdentifierName(v2ClientType.node);
updateV2ClientType(j, v2ClientType, { ...clientTypeOptions, v2ClientTypeName });
return getV3ClientType(j, { ...clientTypeOptions, v2ClientTypeName });
});

// Replace type reference to client type with modules.
Expand Down
33 changes: 0 additions & 33 deletions src/transforms/v2-to-v3/ts-type/updateV2ClientType.ts

This file was deleted.

0 comments on commit 0296d75

Please sign in to comment.