Skip to content

Refactoring suggtion: convert to namespace import #24044

@mjbvz

Description

@mjbvz

Search Terms

  • Refactor
  • import

Suggestion

For the code:

import { a, b, c} from './xyz';

console.log(a, b, c);

Add a refactoring to convert the import to:

import * as xyz from './xyz';

console.log(xyz.a, xyz.b, xyz.c);

With a rename being triggered on xyz

Use Cases

I can see this being useful:

  • List of imports become too long and unmanageable.
  • Make it clear in code where a name comes from

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureDomain: LS: Refactoringse.g. extract to constant or function, rename symbolFixedA PR has been merged for this issueSuggestionAn idea for TypeScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions