Original practice questions written by SynfraCore, not real exam questions. 20 questions, free, no login required — your score is kept in this browser tab only and resets if you reload.
1. What's the difference between `any` and `unknown` in TypeScript?
Types
2. What does `type ID = string | number;` define?
Interfaces & Type Aliases
3. You write two `interface` blocks with the identical name in one file. Does TypeScript merge them, or reject the second one?
Interfaces & Type Aliases
4. Which of these can a `type` alias do that a plain `interface` cannot?
Generics
5. In `function wrap<T>(value: T): { value: T }`, what does `T` represent?
Generics
6. What does the utility type `Partial<User>` produce, given `type User = { id: string; name: string }`?
Generics
7. What's the difference between `Pick<User, "id" | "name">` and `Omit<User, "role">` (where User has id, name, and role)?
Narrowing
8. Inside `if (typeof val === "string") { ... }`, what does TypeScript know about `val`'s type inside that block?
Narrowing
9. Given a union of `{ status: "ok"; payload: string }` and `{ status: "error"; message: string }`, what pattern lets TypeScript safely narrow on a `switch (result.status)`?
Narrowing
10. What does a user-defined type guard function like `function isString(val: unknown): val is string` enable?
tsconfig
11. What does enabling `"strict": true` in tsconfig.json actually do?
tsconfig
12. What does `strictNullChecks` (part of the strict bundle) change about how `null` and `undefined` are treated?
tsconfig
13. What's the practical difference between `target` and `module` in tsconfig.json's compilerOptions?
Compiler
14. What does running `tsc --noEmit` do differently from a plain `tsc`?
Compiler
15. Why do fast tools like `tsx`/`esbuild`-based transpilers run TypeScript faster than `tsc` in watch mode, and what's the real trade-off?
Types
16. A conditional type `Unwrap<T> = T extends Array<infer Item> ? Item : T;` is applied to `Array<number>`. What's the result?
Types
17. What does a mapped type like `type Frozen<T> = { readonly [Key in keyof T]: T[Key] }` produce?
Interfaces & Type Aliases
18. What does `type EventName<T extends string> = `on${Capitalize<T>}`;` produce when T is "click"?
Narrowing
19. Why does TypeScript's narrowing on a discriminated union fail to work if the shared 'tag' property isn't a literal type (e.g. it's typed as plain `string` instead of `"circle" | "square"`)?
Compiler
20. What's the real-world risk of setting `skipLibCheck: true` in tsconfig.json, and why do most projects still enable it?