tsc-absolute
raw JSON → 1.0.1 verified Fri May 01 auth: no javascript
A drop-in wrapper for the TypeScript compiler (tsc) that converts relative file paths in error messages to absolute paths. Current stable version is 1.0.1, released periodically with no fixed cadence. Key differentiator: solves a long-standing TypeScript feature request without modifying the compiler itself. Useful for monorepo navigation and CI/CD error parsing. Acts as a simple regex-based log transformer, requiring TypeScript >=4.6 as a peer dependency. Ships with TypeScript types and works in any environment where tsc runs, but accuracy depends on TypeScript's logging format staying stable.
Common errors
error Error: Cannot find module 'typescript' ↓
cause TypeScript is not installed or is a missing peer dependency.
fix
Run 'npm install --save-dev typescript' to install TypeScript >=4.6.
error tsc-absolute: command not found ↓
cause tsc-absolute is not installed globally or accessible via npx.
fix
Run 'npm install --save-dev tsc-absolute' in your project directory, then use 'npx tsc-absolute'.
error The 'tsc-absolute' package has no exported member 'default'. ↓
cause Attempting to import tsc-absolute as a JavaScript module; it is a CLI tool with no module exports.
fix
Do not import tsc-absolute in code. Use it as a command-line tool via npm scripts or npx.
Warnings
gotcha tsc-absolute uses regex to transform tsc output; it may break if TypeScript changes its logging format. The wrapper is not an official TypeScript feature. ↓
fix Monitor TypeScript releases for formatting changes; pin TypeScript version if stability is critical.
gotcha Extremely unusual filenames (with spaces and brackets) can cause regex matching errors. Most users will never encounter this, but it exists in edge cases. ↓
fix Avoid filenames with spaces and brackets in project paths, or validate error output manually.
breaking Requires TypeScript >=4.6 as a peer dependency. Older TypeScript versions are not tested and may not work. ↓
fix Upgrade TypeScript to >=4.6.
gotcha tsc-absolute does not provide a programmatic API; it must be invoked as a CLI tool. Attempting to import it as a module will fail. ↓
fix Use child_process.exec or similar to run tsc-absolute as a command.
Install
npm install tsc-absolute yarn add tsc-absolute pnpm add tsc-absolute Imports
- default (executable) wrong
npx tsc --strictcorrectnpx tsc-absolute --strict - TypeScript configuration wrong
tsc-absolute -p tsconfig.jsoncorrecttsc-absolute --project tsconfig.json - Node.js child_process exec wrong
require('tsc-absolute')correctexecSync('npx tsc-absolute --noEmit', {cwd: '/path'})
Quickstart
// 1. Install
npm install --save-dev typescript tsc-absolute
// 2. Add to package.json scripts
"scripts": {
"build": "tsc-absolute --strict",
"typecheck": "tsc-absolute --noEmit"
}
// 3. Run
npm run typecheck
// Output includes absolute paths like:
// /home/user/project/src/index.ts(10,5): error TS2322: ...