TypeScript Compiler Hooks
Installation
For Project Specific tsc
:
yarn add tsc-hooks --dev
For Global tsc
:
yarn global add tsc-hooks
Getting Started
Example tsconfig.json
{
"compilerOptions": {
"outDir": "dist"
},
"include": [ "src/**/*" ],
"exclude": [ "src/**/*.txt" ],
"hooks": [ "copy-files" ] // hooks is a new property you can add to tsconfig to add custom hooks
/* For more hooks look below... */
}
Available Hooks
Hook ID | Description | Author |
---|
copy-files |
tsc does not copy over extra files like .xml, .txt, .html, etc. after compilation.
This hook fixes this by copying over files specified in "include". It also ignores files specified in "exclude".
| Mark Auger (swimauger) |
<your-hook-id> | Learn how to create your own hook here | <Your name here> |
What Can TSC Hooks Do?
- TypeScript Compiler hooks are scripts that can execute on compilation of your TypeScript project using
tsc
- They can provide new tsconfig options to help your project run smoother
- They can add new functionality to the compilation process