Repository: TypeScript
Issue: explainFiles should explain default typeRoot
Labels: Suggestion,Awaiting More Feedback

# Suggestion

https://www.typescriptlang.org/tsconfig#typeRoots says

> Packages in `node_modules/@types` of any enclosing folder are considered visible. For example, that means packages within `./node_modules/@types/`, `../node_modules/@types/`, `../../node_modules/@types/`, and so on.

But this behavior is not explicit mentioned in explainFiles output.
This should be something like:
Found `node_modules/@types/node` to include (because compilerOptions typeRoots is undefined)

## 🔍 Search Terms

explainFiles, typeRoots, types

## ✅ Viability Checklist

My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).

## 📃 Motivating Example

I had script code with a compile in a subfolder:

```
 node.exe .\ts-compatibility\4.9.5\node_modules\typescript\bin\tsc --explainFiles --noEmit --target es2015  --lib DOM,DOM.Iterable,ES2015 hmi.d.ts
node_modules/@types/node/globals.d.ts:72:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'AbortSignal' must be of type '{ new (): AbortSignal; prototype: AbortSignal; abort(reason?: any): AbortSignal; timeout(milliseconds: number): AbortSignal; }', but here has type '{ new (): AbortSignal; prototype: AbortSignal; }'.

72 declare var AbortSignal: {
               ~~~~~~~~~~~

  ts-compatibility/4.9.5/node_modules/typescript/lib/lib.dom.d.ts:2071:13
    2071 declare var AbortSignal: {
                     ~~~~~~~~~~~
    'AbortSignal' was also declared here.

ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es5.d.ts
  Library referenced via 'es5' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es5' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts
################ Why lib.es2016.d.ts till lib.es20120.d.ts ?
  Library referenced via 'es2015' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2016.d.ts'
  Library 'lib.es2015.d.ts' specified in compilerOptions
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2016.d.ts
  Library referenced via 'es2016' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.d.ts
  Library referenced via 'es2017' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.d.ts
  Library referenced via 'es2018' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2019.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2019.d.ts
  Library referenced via 'es2019' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2020.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2020.d.ts
#####################
Why the jump tsc to the parent dir node_module now? This should be more explained.
#####################
  Library referenced via 'es2020' from file 'node_modules/@types/node/index.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.dom.d.ts
  Library 'lib.dom.d.ts' specified in compilerOptions
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.dom.iterable.d.ts
  Library 'lib.dom.iterable.d.ts' specified in compilerOptions
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.core.d.ts
  Library referenced via 'es2015.core' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.core' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.collection.d.ts
  Library referenced via 'es2015.collection' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.collection' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.generator.d.ts
  Library referenced via 'es2015.generator' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.generator' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.iterable.d.ts
  Library referenced via 'es2015.iterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.iterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.generator.d.ts'
  Library referenced via 'es2015.iterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts'
  Library referenced via 'es2015.iterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2019.object.d.ts'
  Library referenced via 'es2015.iterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2020.string.d.ts'
  Library referenced via 'es2015.iterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts'
  Library referenced via 'es2015.iterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.iterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.generator.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.promise.d.ts
  Library referenced via 'es2015.promise' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.promise' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.proxy.d.ts
  Library referenced via 'es2015.proxy' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.proxy' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.reflect.d.ts
  Library referenced via 'es2015.reflect' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.reflect' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.symbol.d.ts
  Library referenced via 'es2015.symbol' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.iterable.d.ts'
  Library referenced via 'es2015.symbol' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.symbol' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts'
  Library referenced via 'es2015.symbol' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts'
  Library referenced via 'es2015.symbol' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts'
  Library referenced via 'es2015.symbol' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts'
  Library referenced via 'es2015.symbol' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.iterable.d.ts'
  Library referenced via 'es2015.symbol' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.symbol' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts
  Library referenced via 'es2015.symbol.wellknown' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
  Library referenced via 'es2015.symbol.wellknown' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts'
  Library referenced via 'es2015.symbol.wellknown' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2015.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2016.array.include.d.ts
  Library referenced via 'es2016.array.include' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2016.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.object.d.ts
  Library referenced via 'es2017.object' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts
  Library referenced via 'es2017.sharedmemory' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.string.d.ts
  Library referenced via 'es2017.string' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.intl.d.ts
  Library referenced via 'es2017.intl' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts
  Library referenced via 'es2017.typedarrays' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2017.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts
  Library referenced via 'es2018.asyncgenerator' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts
  Library referenced via 'es2018.asynciterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.d.ts'
  Library referenced via 'es2018.asynciterable' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts'
  Library referenced via 'esnext.asynciterable' from file 'node_modules/@types/node/index.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.intl.d.ts
  Library referenced via 'es2018.intl' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.d.ts'
  Library referenced via 'es2018.intl' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2020.intl.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.promise.d.ts
  Library referenced via 'es2018.promise' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.regexp.d.ts
  Library referenced via 'es2018.regexp' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2018.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2019.array.d.ts
  Library referenced via 'es2019.array' from file 'ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2019.d.ts'
ts-compatibility/4.9.5/node_modules/typescript/lib/lib.es2019.object.d.ts