Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task
trivikr opened this issue Aug 2, 2023 · 1 comment · May be fixed by #533
Open
1 task
Labels
bug Something isn't working p3 This is a minor priority issue

Comments

@trivikr
Copy link
Member

trivikr commented Aug 2, 2023

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

@trivikr trivikr added bug Something isn't working triage Triaging bugs p3 This is a minor priority issue and removed triage Triaging bugs labels Aug 2, 2023
@trivikr
Copy link
Member Author

trivikr commented Aug 2, 2023

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.

@trivikr trivikr changed the title [Bug?]: v2-to-v3 codemod imports DynamoDB.DocumentClient non AttributeValue types from lib-dynamodb [Bug]: v2-to-v3 codemod imports DynamoDB.DocumentClient non AttributeValue types from lib-dynamodb Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p3 This is a minor priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant