{"id":26530,"library":"tsconfig-extends","title":"tsconfig-extends","description":"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.","status":"maintenance","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/ikatyang/tsconfig-extends","tags":["javascript","compiler-options","extends","tsconfig","typescript"],"install":[{"cmd":"npm install tsconfig-extends","lang":"bash","label":"npm"},{"cmd":"yarn add tsconfig-extends","lang":"bash","label":"yarn"},{"cmd":"pnpm add tsconfig-extends","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM import is the standard. CJS require works but destructure the module.","wrong":"const load_file_sync = require('tsconfig-extends').load_file_sync","symbol":"load_file_sync","correct":"import { load_file_sync } from 'tsconfig-extends'"},{"note":"Not a default export; named exports only.","wrong":"import tsconfig from 'tsconfig-extends'; tsconfig.load_config_sync(...)","symbol":"load_config_sync","correct":"import { load_config_sync } from 'tsconfig-extends'"},{"note":"TypeScript type only – do not use as runtime value. Import with `import type` for clarity.","wrong":"import { TSConfig } from 'tsconfig-extends'","symbol":"TSConfig","correct":"import type { TSConfig } from 'tsconfig-extends'"}],"quickstart":{"code":"import { load_file_sync } from 'tsconfig-extends';\nimport * as path from 'path';\n\nconst tsconfigPath = path.resolve('./tsconfig.json');\ntry {\n  const options = load_file_sync(tsconfigPath);\n  console.log('Compiler options:', options);\n} catch (err) {\n  console.error('Failed to load tsconfig:', err);\n}","lang":"typescript","description":"Load compiler options from tsconfig.json with extends resolution, handling errors."},"warnings":[{"fix":"Wrap in try/catch or validate file existence before calling.","message":"load_file_sync throws if tsconfig.json is missing or invalid JSON / TypeScript config","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Cache result manually if calling multiple times with same path.","message":"The library does not cache results; repeated calls re-read and re-resolve the entire extends chain","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Consider using @typescript-eslint/parser's built-in tsconfig resolution or tsconfig-paths for advanced needs.","message":"Project is in maintenance mode; no updates since 2017, no support for newer TypeScript features (e.g., references, path mapping from tsconfig)","severity":"deprecated","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import { load_file_sync } from 'tsconfig-extends' or const { load_file_sync } = require('tsconfig-extends');","cause":"CommonJS require without destructuring vs named export","error":"TypeError: load_file_sync is not a function"},{"fix":"Run: npm install tsconfig-extends","cause":"Package not installed","error":"Error: Cannot find module 'tsconfig-extends'"},{"fix":"Use require() or set \"type\": \"module\" in package.json or use dynamic import.","cause":"Using ESM import in a CommonJS environment (Node < 13 or without \"type\":\"module\")","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}