It looks like the plugin is attempting to find non-type imports in the destructuring-style import and break them out into a separate line, since if you import a variable from the file as well:
import { type TFirstTest, type TSecondTest, variable } from "./typeImportTest.types";
then the resulting output is valid:
import { variable } from "./typeImportTest.types";
import type { TFirstTest, TSecondTest } from "./typeImportTest.types";
So it looks like the fix would be to check whether there are any non-type imports extracted from the import group before appending another import.
Your Environment
Describe the bug
When running prettier on a file that has multiple inline type imports from the same file:
the plugin will add another side-effect import for the same file:
To Reproduce
Run
prettier -w typeImportTest.ts
Expected behaviour
File should remain unchanged.
Actual behaviour
Configuration File (.prettierrc.js)
Additional thoughts
It looks like the plugin is attempting to find non-type imports in the destructuring-style import and break them out into a separate line, since if you import a variable from the file as well:
then the resulting output is valid:
So it looks like the fix would be to check whether there are any non-type imports extracted from the import group before appending another import.