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

[Feature]: Declare variables used in the code after import equals global variable #614

Closed
1 task
trivikr opened this issue Oct 17, 2023 · 1 comment · Fixed by #615
Closed
1 task

[Feature]: Declare variables used in the code after import equals global variable #614

trivikr opened this issue Oct 17, 2023 · 1 comment · Fixed by #615
Labels
enhancement New feature or request p2 This is a standard priority issue

Comments

@trivikr
Copy link
Member

trivikr commented Oct 17, 2023

Self-service

  • I'd be willing to implement this feature

Problem

In #603, we added named imports for require/import.

Since import equals does not support named imports, we started using property access from global import as follows:

import AWS_S3 = require("@aws-sdk/client-s3");

const client = new AWS_S3.S3();

This is not scalable when it comes to maintenance, as the importType needs to be passed to each function, and need to compute default local name while replacing types or client instances.

Solution

Use destructuring after the last import as follows:

import AWS_S3 = require("@aws-sdk/client-s3");
import S3 = AWS_S3.S3;

const client = new S3();

Alternatives

N/A

Additional context

No response

@trivikr trivikr added enhancement New feature or request p2 This is a standard priority issue labels Oct 17, 2023
Copy link
Contributor

github-actions bot commented Nov 1, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request p2 This is a standard priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant