aws-sdk-js-codemod
aws-sdk-js-codemod copied to clipboard
[Bug]: v2-to-v3 codemod imports DynamoDB.DocumentClient non AttributeValue types from lib-dynamodb
trafficstars
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:
import AWS from "aws-sdk";
const endpoint: AWS.DynamoDB.DocumentClient.Endpoint = {
Address: "string",
CachePeriodInMinutes: 5,
};
Observed behavior
Output code:
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
import * as AWS_DynamoDB from "@aws-sdk/client-dynamodb";
const endpoint: AWS_DynamoDB.Endpoint = {
Address: "string",
CachePeriodInMinutes: 5,
};
Environment
aws-sdk-js-codemod: 0.17.3
- jscodeshift: 0.15.0
- recast: 0.23.3
Additional context
No response
The fix for this issue is not straightforward, as only the top-level inputs and any types which use AttributeValue should import from DocumentClient, while types should be imported from DynamoDB client.
Marking this as p3, as the issue is only with TypeScript types and can be fixed with by doing manual import.