aws / aws/aws-sdk-js-codemod

[Bug]: v2-to-v3 codemod imports DynamoDB.DocumentClient non AttributeValue types from lib-dynamodb

Open
#530 1 comment 0 reactions 0 assignees View on GitHub
bug p3
Dominant language
TypeScript
Stars
89
Forks
13
Avg merge
9h 59m
Merged PRs (30d)
1

Description

### Self-service

- [ ] I'd be willing to implement a fix

### Describe the bug

The v2-to-v3 codemod imports DynamoDB.DocumentClient non AttributeValue types from lib-dynamodb

### Steps to reproduce

Input code:

```ts
import AWS from "aws-sdk";

const endpoint: AWS.DynamoDB.DocumentClient.Endpoint = {
Address: "string",
CachePeriodInMinutes: 5,
};
```

### Observed behavior

Output code:

```ts
import * as AWS_DynamoDBDocumentClient from "@aws-sdk/lib-dynamodb";

const endpoint: AWS_DynamoDBDocumentClient.Endpoint = {
Address: "string",
CachePeriodInMinutes: 5,
};
```

### Expected behavior

Since lib-dynamodb does not re-export types from DynamoDB, the code should import type from DynamoDB instead

```ts
import * as AWS_DynamoDB from "@aws-sdk/client-dynamodb";

const endpoint: AWS_DynamoDB.Endpoint = {
Address: "string",
CachePeriodInMinutes: 5,
};
```

### Environment

```shell
aws-sdk-js-codemod: 0.17.3
- jscodeshift: 0.15.0
- recast: 0.23.3
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by running the v2-to-v3 codemod with the TypeScript reproduction shown in the issue and locate the transformation that maps DynamoDB.DocumentClient types. Verify that non-AttributeValue types such as Endpoint are imported from @aws-sdk/client-dynamodb rather than @aws-sdk/lib-dynamodb; the expected output in the issue defines done.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, nodejs, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.