VS Code's 'Organize imports' executable from command line
I have noticed this issue recently in projects. In TypeScript files, whenever a type from a different module is exclusively used in `satsifies` type assertions, the `organize-imports` CLI strips the type from the import, resulting in the file having compilation errors. ## Example ### types.ts ```ts export type Content = { text: string; }; export const buildContent = (arg: Content) => { // implementation }; ``` ### main.ts ```ts import { Content, buildContent } from "./types"; buildContent({ text: "my text" } satisfies Content); ``` When running `organize-imports`, I would expect `main.ts` to remain the same, however the output ends up being: ```ts import { buildContent } from "./types"; buildContent({ text: "my text" } satisfies Content); // ERROR: Content is not defined! ``` Which is a compile-time error because of the missing type identifier. ## Workaround I do have a workaround for now, by referencing the type in a type alias: ```ts import { Content, buildContent } from "./types"; type __Keep = Content; buildContent({ text: "my text" } satisfies Content); ```
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by thetos7 and has received 2 comments.