Skip to content

Commit 5f1a930

Browse files
authored
Support transformation for types with type annotation (#550)
1 parent 1431238 commit 5f1a930

23 files changed

+113
-108
lines changed

.changeset/tricky-mirrors-buy.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+
Support transformation for types with type annotation
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const AWS = require("aws-sdk");
22

3-
const testTags: AWS.S3.Tag[] = [{ Key: "key", Value: "value" }];
3+
const testTags: typeof AWS.S3.Tag[] = [{ Key: "key", Value: "value" }];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const AWS_S3 = require("@aws-sdk/client-s3");
22

3-
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }];
3+
const testTags: typeof AWS_S3.Tag[] = [{ Key: "key", Value: "value" }];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const S3 = require("aws-sdk/clients/s3");
22

3-
const testTags: S3.Tag[] = [{ Key: "key", Value: "value" }];
3+
const testTags: typeof S3.Tag[] = [{ Key: "key", Value: "value" }];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const AWS_S3 = require("@aws-sdk/client-s3");
22

3-
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }];
3+
const testTags: typeof AWS_S3.Tag[] = [{ Key: "key", Value: "value" }];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const { S3 } = require("aws-sdk");
22

3-
const testTags: S3.Tag[] = [{ Key: "key", Value: "value" }];
3+
const testTags: typeof S3.Tag[] = [{ Key: "key", Value: "value" }];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const AWS_S3 = require("@aws-sdk/client-s3");
22

3-
const testTags: AWS_S3.Tag[] = [{ Key: "key", Value: "value" }];
3+
const testTags: typeof AWS_S3.Tag[] = [{ Key: "key", Value: "value" }];
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const AWS = require("aws-sdk");
22

33
const ddbClient = new AWS.DynamoDB({ region: "us-west-2" });
4-
const listTablesInput: AWS.DynamoDB.ListTablesInput = { Limit: 10 };
5-
const listTablesOutput: AWS.DynamoDB.ListTablesOutput = await ddbClient
4+
const listTablesInput: typeof AWS.DynamoDB.ListTablesInput = { Limit: 10 };
5+
const listTablesOutput: typeof AWS.DynamoDB.ListTablesOutput = await ddbClient
66
.listTables(listTablesInput)
77
.promise();
88

99
const stsClient = new AWS.STS({ region: "us-west-2" });
10-
const getCallerIdentityInput: AWS.STS.GetCallerIdentityRequest = {};
11-
const getCallerIdentityOutput: AWS.STS.GetCallerIdentityResponse = await stsClient
10+
const getCallerIdentityInput: typeof AWS.STS.GetCallerIdentityRequest = {};
11+
const getCallerIdentityOutput: typeof AWS.STS.GetCallerIdentityResponse = await stsClient
1212
.getCallerIdentity(getCallerIdentityInput)
1313
.promise();

src/transforms/v2-to-v3/__fixtures__/api-input-output-type/global-require.output.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const AWS_DynamoDB = require("@aws-sdk/client-dynamodb"),
88
} = AWS_STS;
99

1010
const ddbClient = new DynamoDB({ region: "us-west-2" });
11-
const listTablesInput: AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 };
12-
const listTablesOutput: AWS_DynamoDB.ListTablesCommandOutput = await ddbClient
11+
const listTablesInput: typeof AWS_DynamoDB.ListTablesCommandInput = { Limit: 10 };
12+
const listTablesOutput: typeof AWS_DynamoDB.ListTablesCommandOutput = await ddbClient
1313
.listTables(listTablesInput);
1414

1515
const stsClient = new STS({ region: "us-west-2" });
16-
const getCallerIdentityInput: AWS_STS.GetCallerIdentityCommandInput = {};
17-
const getCallerIdentityOutput: AWS_STS.GetCallerIdentityCommandOutput = await stsClient
16+
const getCallerIdentityInput: typeof AWS_STS.GetCallerIdentityCommandInput = {};
17+
const getCallerIdentityOutput: typeof AWS_STS.GetCallerIdentityCommandOutput = await stsClient
1818
.getCallerIdentity(getCallerIdentityInput);

src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-require-deep.input.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ const DynamoDB = require("aws-sdk/clients/dynamodb");
22
const STS = require("aws-sdk/clients/sts");
33

44
const ddbClient = new DynamoDB({ region: "us-west-2" });
5-
const listTablesInput: DynamoDB.ListTablesInput = { Limit: 10 };
6-
const listTablesOutput: DynamoDB.ListTablesOutput = await ddbClient
5+
const listTablesInput: typeof DynamoDB.ListTablesInput = { Limit: 10 };
6+
const listTablesOutput: typeof DynamoDB.ListTablesOutput = await ddbClient
77
.listTables(listTablesInput)
88
.promise();
99

1010
const stsClient = new STS({ region: "us-west-2" });
11-
const getCallerIdentityInput: STS.GetCallerIdentityRequest = {};
12-
const getCallerIdentityOutput: STS.GetCallerIdentityResponse = await stsClient
11+
const getCallerIdentityInput: typeof STS.GetCallerIdentityRequest = {};
12+
const getCallerIdentityOutput: typeof STS.GetCallerIdentityResponse = await stsClient
1313
.getCallerIdentity(getCallerIdentityInput)
1414
.promise();

0 commit comments

Comments
 (0)