Skip to content

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

Open
@trivikr

Description

@trivikr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp3This is a minor priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions