aws-sdk-js-codemod icon indicating copy to clipboard operation
aws-sdk-js-codemod copied to clipboard

[Feature]: If input import is type only then output import should be type only

Open trivikr opened this issue 7 months ago • 0 comments

Self-service

  • [ ] I'd be willing to implement this feature

Problem

The typeOnly import is replaced to normal import by codemod

Example input:

import type { DescribeStacksInput } from "aws-sdk/clients/cloudformation";

const foo: DescribeStacksInput = {};

Example output:

import { DescribeStacksCommandInput } from "@aws-sdk/client-cloudformation";

const foo: DescribeStacksCommandInput = {};

Solution

If input contains typeonly import, use typeonly export in output

import type { DescribeStacksCommandInput } from "@aws-sdk/client-cloudformation";

const foo: DescribeStacksCommandInput = {};

Alternatives

N/A

Additional context

https://github.com/getlift/lift/blob/a91e293dcd889b3d0153444ed0b55afea470822f/src/CloudFormation.ts#L1

trivikr avatar Nov 13 '23 23:11 trivikr