#Change the module something is imported from using the TS API.

4 messages · Page 1 of 1 (latest)

quasi cargo
#

Hey yall, I found out about the typescript API recently and is playing around with making my own transformer and I hit a roadblock. Basically, I want to change the name of the module something is imported from. For example:

// input
import Foo from "bar"
// output
import Foo from "world"

I could not really find a good resource for it. Could anyone point me in the correct direction?

scarlet forum
#

@quasi cargo Instead of using the TS API directly, I'd recommend looking at ts-morph which is generally an easier to use wrapper

quasi cargo
quasi cargo
#

yeah ts-morph sounds like a good idea. thanks again