Skip to content

Conversation

@andrewbranch
Copy link
Member

Closes #53008

  1. When more than one import declaration from the same module specifier exists, find the one that’s the best match with respect to type-onlyness instead of modifying the first one to work:
    import type {} from "react"; // <-- auto-imported types will go here
    import {} from "react";      // <-- auto-imported values will go here
  2. When promoting a type-only import declaration to a real one due to a new value import, always add type modifiers to the existing specifiers, even if emit settings don’t require it. For example, if a value import of SomeValue is to be auto-imported here:
    import type { SomeType } from "mod";
    the result will now always be:
    import { SomeValue, type SomeType } from "mod";
    regardless of compiler options. Previously, we would only insert the type modifier on SomeType if it was necessary according to compiler options, e.g. if verbatimModuleSyntax is enabled.

@andrewbranch andrewbranch requested a review from jakebailey March 30, 2023 17:20
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Mar 30, 2023
@andrewbranch andrewbranch merged commit 52a8061 into microsoft:main Mar 30, 2023
@andrewbranch andrewbranch deleted the bug/53008 branch March 30, 2023 19:01
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-import will always use the first import instead of looking for the first import of the correct kind

3 participants