Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tsconfig.json: Specify <root> in "include" and "exclude" for extends configs

See original GitHub issue


As always, thanks again for all of your hard work on the TypeScript tooling and ecosystem! 🙌

Extends configs (configs referenced from "extends") can specify "include" and "exclude", but they are relative to the tsconfig.json file (which could be deep in node_modules) instead of the root of the directory, per the include docs:

These filenames are resolved relative to the directory containing the tsconfig.json file.

This means that the following configuration would not work as expected:


  "extends": "@upleveled/eslint-config-upleveled/templates/tsconfig.json"


  "include": [

(this would resolve relative to the node_modules deep path, which would be useless)

Removal of such broken config can also be seen in the wild here:

Suggestion 1: <root> directory specifier

It would be great to get a <root> capability to add to include and exclude paths to refer to the directory with the package.json file, like Jest’s <rootDir> option:

  "include": [

Suggestion 2: tsconfig.ts

Another idea for implementation would be to have a code-based config (ideally tsconfig.ts, as @weswigham mentions in - I’m guessing this would open up alternative ways to retrieve the root directory of the project.

Allowing TS / JS configs is a common pattern in developer tooling, and covers many use cases beyond this issue.

🔍 Search Terms

extends, extended, root directory, root folder, configs, tsconfig

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn’t be a breaking change in existing TypeScript/JavaScript code
  • This wouldn’t change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript’s Design Goals.

⭐ Suggestion

In the description above

📃 Motivating Example

In the description above

💻 Use Cases


Specify the paths using relative paths:

  "include": [

But here this encodes the directory structure of node_modules into the config as well, which is brittle.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

MartinJohnscommented, Oct 18, 2022

Related: #20110

fatcerberuscommented, Oct 18, 2022

Using include in an extends’d config seems useless in general (or at least highly situational) because according to the docs:

It’s worth noting that files, include and exclude from the inheriting config file overwrite those from the base config file

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSConfig Reference - Docs on every TSConfig option
It has no interaction with the include , exclude , or files tsconfig.json settings. Note that TypeScript will never write an output file...
Read more >
tsconfig.json - TypeScript - JavaScript that scales.
The extends is a top-level property in tsconfig.json (alongside compilerOptions , files , include , and exclude ). extends ' value is a...
Read more >
tsconfig.json: Build:No inputs were found in config file
Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["../wwwroot/app","node_modules/*"]'. 1> The command exited with code 1. 1> Done executing ...
Read more >
Understanding TypeScript Configuration Options
files - include - exclude - extends - typeAcquisition ... rootDirs - typeRoots ... Let's say we have tsconfig.base.json and tsconfig.json .
Read more >
Options - TypeDoc
Specify a tsconfig.json file that options should be read from. If not specified TypeDoc will look for tsconfig.json in the current directory and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found