stringham / move-ts

A Visual Studio Code plugin for updating relative imports when moving typescript files and folders in your workspace.
MIT License
52 stars 15 forks source link

Move TS declarations to existing file with import update #37

Closed musikobios closed 4 months ago

musikobios commented 2 years ago

Hello there! This is an ask for new feature not an actual issue. It would be really helpful to move some TS declarations to already existing files eg. move from a.ts and append to b.ts, and auto update the imports of c.ts.

// (a.ts)
-export type MyType {
-  x: string;
-  y: boolean;
-  z: object;
-}

and append to existing b.ts:

// b.ts
export type OldType {
  field: number;
}

+export type MyType {
+  x: string;
+  y: boolean;
+  z: object;
+}

So the imports of c.ts will now become:

// c.ts
- import MyType from "./a.ts"
+ import MyType from "./b.ts"
Papooch commented 1 year ago

This is already a built-in feature of VSCode. Select code, press Ctrl/Cmd+., select "Move to file". All imports everywhere will be updated. image