All quizzesHard
Compiler API & References — Series 3
Preview — 3 of 10 questions
javascript
{ "compilerOptions": { "skipLibCheck": true, "declaration": true } }AIt skips only node_modules/**/*.d.ts; your own declarations are still checked
BIt skips type checking of every .d.ts file in the program — dependencies, @types packages and your own emitted declarations alike — while still using them for resolution
CIt skips loading the default lib.*.d.ts files, so built-in globals become any
DIt skips emitting declaration files, making declaration: true a no-op
javascript
{ "compilerOptions": { "declaration": true, "isolatedDeclarations": true } }ACompiles fine — the return type is trivially inferable
BCompiles fine, and the emitted .d.ts declares add(a: number, b: number): any
CA config error — isolatedDeclarations cannot be combined with declaration
DA compile-time error — every exported declaration must be explicitly annotated so a .d.ts can be produced from the file alone
javascript
// noUncheckedIndexedAccess: true
const arr: string[] = ["a"];
const tup: [string, number] = ["a", 1];
const rec: Record<string, number> = { a: 1 };
const a = arr[0];
const b = tup[0];
const c = rec.a;
for (const x of arr) { /* x */ }Aa is string | undefined and c is number | undefined; b is string and x is string
BAll four are widened with | undefined
COnly a is widened — the flag applies to arrays alone
DNone are widened — the flag only affects writes, not reads
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.