Tsmod
Refactor TypScript code programmatically using codemods.
Installation
npm install -g tsmod
Usage
The following example applies the transform ./var_to_const_tramsform.ts
to the files ./fileA.ts
and ./fileB.ts
:
tsmod -t ./var_to_const_tramsform.ts ./fileA.ts ./fileB.ts
Please Note: A
tsconfig.json
file is expected in the current directory when you run the previous command.
Transform example
The transfroms are powered by ts-morph
you can learn more about the API at https://ts-morph.com.
The following example changes all var
variable declarations into const
variable declarations:
; ;
Options
For additional help use the following:
tsmod -h