tsc-hooks (v1.1.2) is a TypeScript compiler hook system that extends tsc's functionality by allowing custom scripts to run before or after compilation. It integrates via a new 'hooks' array in tsconfig.json, enabling built-in hooks like 'copy-files' (to copy non-TypeScript files) and 'file-permissions' (to set file permissions). The package requires TypeScript ^4.3.2 || ^5.0.2 as a peer dependency. It is actively maintained with a simple configuration approach, differing from alternatives like ts-patch or ttypescript by providing a hook interface rather than patching the compiler API.
npm install tsc-hooksNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to configure and use the copy-files hook via tsconfig.json to copy static assets after compilation.
Ensure tsc-hooks is installed and invoked (e.g., via npx tsc) to process hooks; otherwise they are ignored.
Arrange hooks array in desired execution order.
Use 'exclude' in tsconfig to skip .ts files if they should not be copied.
Upgrade TypeScript to ^5.0.2 or later.
Run `npm install --save-dev tsc-hooks`
Use npx tsc instead of plain tsc, or ensure tsc-hooks is required before tsc.
Use ES module import syntax: import tscHooks from 'tsc-hooks'