TS Internals — Series 3

Preview — 3 of 10 questions

javascript
tsc -p tsconfig.json --showConfig
AValidates the config and prints only the options you wrote, verbatim
BPrints the JSON schema that tsconfig.json is validated against
CPrints the fully resolved configuration — extends chains flattened, strict expanded into its member flags, implied defaults filled in, and files/include resolved to a concrete file list
DStarts an interactive prompt for editing the configuration

with a tsconfig.json in the same directory setting strict: true and outDir: "dist".

javascript
tsc src/main.ts
Atsconfig.json is ignored entirely — naming input files on the command line disables config-file discovery, so the build runs with compiler defaults
Btsconfig.json is loaded, and src/main.ts simply narrows the file list
CAn error — you may not mix a file argument with a config file in the directory
Dtsconfig.json is loaded, but outDir is ignored for command-line files

javascript
{
  "exports": {
    ".": {
      "import": "./dist/index.mjs",
      "require": "./dist/index.cjs",
      "types": "./dist/index.d.ts"
    }
  }
}
ACorrect — condition order in an "exports" object is irrelevant
BWrong — conditions are matched in declaration order and the first match wins, so "types" must come first or "import"/"require" will match before it and TypeScript will never find the declarations
CWrong — "types" is not a valid export condition; the top-level "types" field must be used instead
DCorrect, but only under moduleResolution: "bundler"

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.