Skip to content

Over TypeScript tool to use custom transformers in the tsconfig.json

Notifications You must be signed in to change notification settings

SlurpTheo/ttypescript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ttypescript

What it is

Currently TypeScript doesn't support custom transformers in the tsconfig.json, but supports its programatically.

And there is no way to compile your files using custom transformers using tsc command.

TTypescript (Transformer Typescript) solves this problem by patching on the fly the compile module to use transformers from tsconfig.json.

How to install

npm i ttypescript --save
npm i -g ttypescript

ttypescript uses your installed typescript in your node_modules

How to use

tsconfig.json

You just need to add the customTransformers block with before and(or) after object contains array of transformer paths into the compilerOptions

{
  "compilerOptions": {
   "customTransformers": {
      "before": [
        "transformermodule"
      ],
      "after": [
        "./or_some_path_in_your_project_directory"
      ]
    }
  }
}

Command line

Like usual tsc, all arguments work the same way.

ttsc

ts-node

ts-node --compiler ttypescript index.ts
or
ts-node -C ttypescript index.ts

Webpack

    {
        test: /\.(ts|tsx)$/,
        include: paths.appSrc,
        loader: require.resolve('ts-loader'),
        options: {
            compiler: 'ttypescript'
        }
    }

Visual Studio Code

Set the config typescript.tsdk to /usr/local/lib/node_modules/ttypescript/lib/

WebStorm

Set in the TypeScript settings tab the typescript path: /usr/local/lib/node_modules/ttypescript or from your project node_modules

License

MIT License

About

Over TypeScript tool to use custom transformers in the tsconfig.json

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%