types and typeRoots: which global declarations load.
- Imports never depend on them:
import { m } from "modlib"finds@types/modlibwhatevertypessays (tsconfig reference). - They control packages that add globals, like
processfrom@types/nodeordescribefrom@types/jest. - TS 6.0 changed the
typesdefault to[]. Before,tscloaded every visible@typespackage. The 6.0 release notes say this was very expensive and that many projects built 20–50% faster withtypesset. You now list what you need ("types": ["node", "jest"]), or write["*"]for the old behaviour. typeRootsis wheretypesnames are found: by default everynode_modules/@typesfrom the tsconfig folder upward; set it and only those folders count.
rootDir and outDir: where output goes.
outDirunset: each.jsis written next to its.ts.- With
outDir, the output mirrors the source tree relative torootDir. Before 6.0,rootDirwas inferred as the common folder of all inputs, sosrc/index.tsbecamedist/index.js. Since 6.0 it defaults to the folder containingtsconfig.json(inferred only when runningtscwithout a tsconfig), so the same file becomesdist/src/index.js. - 6.0.3 and 7.0.2 don't change your layout silently: with
outDirset, norootDir, and inputs that share a deeper folder, they report TS5011 and name the folder to use. Set"rootDir": "./src". - Every input must be under
rootDir, or TS6059.
7.0 keeps both 6.0 defaults; I saw identical results on 6.0.3 and 7.0.2.