Registry / devops / tsconfig-extends

tsconfig-extends

JSON →
library1.0.1jsnpmunverified

Load TypeScript compiler options from tsconfig.json, fully resolving the "extends" chain. v1.0.1 is the latest stable release (no further updates since 2017). Unlike ts-node or tsc built-in resolution, this is a standalone utility for programmatic usage. It resolves inheritance from both relative paths and node_modules packages. Only provides synchronous API. Minimalist: no caching, no validation beyond what TypeScript enforces. Ships TypeScript declarations. For Node.js >= 4.

npm install tsconfig-extends
INSTALL
IMPORT
SIG · TSCONFIG-EXTENDS
T
tsconfig-extends
devopsjavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

load_file_sync
import { load_file_sync } from 'tsconfig-extends'
const load_file_sync = require('tsconfig-extends').load_file_sync
ESM import is the standard. CJS require works but destructure the module.
load_config_sync
import { load_config_sync } from 'tsconfig-extends'
import tsconfig from 'tsconfig-extends'; tsconfig.load_config_sync(...)
Not a default export; named exports only.
TSConfig
import type { TSConfig } from 'tsconfig-extends'
import { TSConfig } from 'tsconfig-extends'
TypeScript type only – do not use as runtime value. Import with `import type` for clarity.

Load compiler options from tsconfig.json with extends resolution, handling errors.

import { load_file_sync } from 'tsconfig-extends'; import * as path from 'path'; const tsconfigPath = path.resolve('./tsconfig.json'); try { const options = load_file_sync(tsconfigPath); console.log('Compiler options:', options); } catch (err) { console.error('Failed to load tsconfig:', err); }
Debug
Known issues
gotchaload_file_sync throws if tsconfig.json is missing or invalid JSON / TypeScript config
fix
Wrap in try/catch or validate file existence before calling.
affects: >=1.0
gotchaThe library does not cache results; repeated calls re-read and re-resolve the entire extends chain
fix
Cache result manually if calling multiple times with same path.
affects: >=1.0
deprecatedProject is in maintenance mode; no updates since 2017, no support for newer TypeScript features (e.g., references, path mapping from tsconfig)
fix
Consider using @typescript-eslint/parser's built-in tsconfig resolution or tsconfig-paths for advanced needs.
affects: >=1.0
Errors
Common errors & fixes
TypeError: load_file_sync is not a function
CommonJS require without destructuring vs named export
fix
Use import { load_file_sync } from 'tsconfig-extends' or const { load_file_sync } = require('tsconfig-extends');
Error: Cannot find module 'tsconfig-extends'
Package not installed
fix
Run: npm install tsconfig-extends
SyntaxError: Unexpected token 'export'
Using ESM import in a CommonJS environment (Node < 13 or without "type":"module")
fix
Use require() or set "type": "module" in package.json or use dynamic import.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
tsconfig-extends — npm install tsconfig-extends · libregistry