John John - 10 days ago 7
TypeScript Question

Module Resolution: Possible staleness of TypeScript documentation

I just read this piece about module resolution in the TypeScript documentation.

I believe that can't possibly be the whole story any longer as according to the section "@types, typeRoots and types" in the documentation of

, type definition files are also picked up from the node_modules/@types directory.

That feature was also announced here and is explained somewhat here.

I write this question on SO as way for people to confirm that I have that right and a documentation bug report for the TypeScript guys (the ticket submission guidelines at GitHub scared me away).

So, am I correct in thinking the linked piece of documentation is incomplete?

Answer

I think you're right. To be more sure (for this or generally) I'd normally take a look at the history of the module resolution docs themselves. They've had quite a few small updates recently, but otherwise the last major commit there was adding the changes in behaviour from TypeScript 1.8, back in March, well before these 2.0 changes. There is a bit more info on these changes under "Declaration Files" > "Consumption" (https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html), but it's mostly focused on the end user case, rather than documenting exactly how tsc finds these type definitions later.

If I were you, I'd open a bug on the TypeScript-Handbook repo and kick off the process to get that updated. To be honest all of this suggests to me that there isn't that much time going into this bit of docs right now -- be prepared that the most effective way to get this updated might well to put together an outline of this yourself, and to then ask for help checking it and filling in the details.