The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use these 100 TypeScript interview questions to practise explaining what the compiler can establish, how types relate, and where runtime checks are still needed. Each answer includes a compact example and the idea an interviewer is likely testing; memorizing definitions alone does not demonstrate production judgment.
TypeScript fundamentals
1. What is TypeScript?
TypeScript builds on JavaScript with syntax for types and a static checker. For example, function double(n: number) { return n * 2; } lets the checker flag a string passed to double. The code still needs a JavaScript runtime; the type annotation is not runtime validation. Interviewers are checking that you distinguish the language’s type system from execution.
2. How does TypeScript relate to JavaScript?
TypeScript is designed to work with JavaScript: JavaScript is valid TypeScript in many contexts, and TypeScript syntax is generally erased or transformed when emitted as JavaScript. const message: string = 'hi'; emits JavaScript without the type annotation. Runtime behavior depends on the emitted code and environment. Interviewers want you to understand compatibility without claiming every TypeScript feature runs natively in every JavaScript environment.
3. What is the difference between a type annotation and type inference?
An annotation states a type; inference lets the checker derive one from context. const count: number = 3; is annotated, while const name = 'Ada'; is inferred. Inference can retain a literal type for a constant and widen in other contexts. Interviewers are testing whether you know when an explicit contract improves clarity and when inference is sufficient.
#1 Best Overall
4. What are primitive types and literal types?
Primitive types include string, number, boolean, bigint, and symbol. A literal type represents a particular value, such as 'ready' or true: let state: 'ready' | 'busy' = 'ready';. A literal union restricts valid values more precisely than string. Interviewers are looking for appropriate precision in a model.
5. How do arrays work in TypeScript?
number[] and Array<number> both describe arrays whose elements are numbers: const scores: number[] = [8, 10];. The checker uses the element type when you read or write values. Neither form validates an array received from an API at runtime. Interviewers are checking basic collection typing and awareness of the runtime boundary.
6. What is a tuple?
A tuple describes an array with known positions and types: const pair: [string, number] = ['age', 42];. It is useful for fixed-shape values such as a key and its value, though named object properties can be clearer for larger records. Interviewers are testing whether you can choose a shape that communicates intent.
7. How do you define an object type?
An object type specifies required and optional members: let user: { id: number; name: string } = { id: 1, name: 'Mina' };. Compatibility is structural: the member names and compatible types matter, not merely a declared class name. Interviewers want you to explain the contract rather than treat types as runtime labels.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
8. What does an optional property mean?
A question mark marks a property that may be absent: type Options = { color?: string };. Reading options.color must account for it being undefined; writing color: undefined may be treated differently depending on compiler settings such as exactOptionalPropertyTypes. Interviewers are checking that optional does not mean “always present but nullable.”
9. What is the difference between null and undefined?
Both represent absent values in JavaScript, but they are distinct values and types. With strictNullChecks enabled, a value typed string cannot be null or undefined unless the union allows it: let name: string | null = null;. Interviewers are testing compiler-option awareness and explicit handling of absence.
10. What is the difference between any and unknown?
any opts out of checking, while unknown accepts any value but requires narrowing before use: function print(x: unknown) { if (typeof x === 'string') console.log(x.toUpperCase()); }. Prefer unknown at uncertain boundaries. Interviewers are testing whether you preserve safety instead of spreading unchecked values.
11. What does void mean?
void commonly describes a function whose return value is not meant to be used: function log(message: string): void { console.log(message); }. It is not interchangeable with every notion of “no value”; for example, a function that never returns normally is described by never. Interviewers want precision about function outcomes.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute12. What does never mean?
never represents a value that cannot occur, often because a function always throws or a union has been fully eliminated: function fail(): never { throw new Error('failed'); }. It is useful for exhaustive checks. Interviewers are looking for understanding of impossible states, not just memorized syntax.
13. What is a type assertion?
An assertion tells the checker to treat an expression as a type: const input = document.querySelector('input') as HTMLInputElement;. It is erased from emitted JavaScript and does not convert or validate the value. Check for null or validate untrusted data at runtime when needed. Interviewers test whether you know an assertion shifts responsibility to the author.
14. What is the difference between a type annotation and an assertion?
An annotation asks the checker to verify that a value meets a declared contract; an assertion asks it to trust a claimed type. const n: number = value; checks assignability, while const n = value as number; does not prove the runtime value is numeric. Interviewers are testing safe use of the type system rather than syntax recognition.
15. What is the difference between compile-time checking and runtime behavior?
The checker reasons about types before execution; JavaScript execution determines runtime behavior. const data = JSON.parse(text) as User; does not establish that the parsed object has the shape of User. A validator must inspect the value at runtime. Interviewers want you to identify where static guarantees end.
Free tools Windows power users keep installed
One-click scans. No signup required.
16. What is an enum?
An enum names a set of values, for example enum Direction { Up, Down }. Depending on the enum form and compilation, it can produce runtime JavaScript. A literal union such as type Direction = 'up' | 'down'; is another option and has different runtime and convention tradeoffs. Interviewers are testing that you choose based on emitted needs and project style.
17. What is type compatibility in TypeScript?
Compatibility is primarily structural: an object with the required compatible members can satisfy a type even if it was not declared with that type. type Point = { x: number }; const p: Point = { x: 1, y: 2 }; works through a variable. Some checks are intentionally pragmatic and the system has documented unsound areas. Interviewers test structural reasoning, not nominal assumptions.
18. What is an excess-property check?
A fresh object literal can receive a diagnostic for an unexpected property: type Point = { x: number }; const p: Point = { x: 1, y: 2 };. Assigning that same value through a variable may be allowed because structural compatibility requires the target’s members but does not generally forbid extras. Interviewers are checking whether you can explain this apparent inconsistency.
19. What does strict do in tsconfig.json?
strict enables a family of stricter type-checking options, including strictNullChecks and noImplicitAny. The exact behavior depends on the compiler version and other configuration. It is a useful baseline, not a universal project configuration. Interviewers are testing whether you treat compiler settings as part of the type environment.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute20. What is the difference between a type error and a runtime error?
A type error is a checker diagnostic about code that does not meet its static constraints; a runtime error occurs when executing JavaScript. A project may emit despite diagnostics depending on its build process and settings, so a reported type error does not itself describe what happens at runtime. Interviewers want a clear distinction between static analysis and execution.
Functions and object modeling
21. How do you type function parameters and return values?
Annotate the parameter and, when helpful, the result: function add(a: number, b: number): number { return a + b; }. The checker also infers many return types, but an explicit return annotation can document a public contract. Interviewers test whether you can make function boundaries understandable and checked.
22. How do optional function parameters work?
A question mark makes a parameter optional, so callers may omit it and the function must handle its absence: function greet(name?: string) { return name ?? 'there'; }. An optional parameter is effectively possibly undefined. Interviewers are checking that both the call site and implementation account for omission.
23. How do default parameters work?
A default supplies a value when an argument is omitted or is undefined: function greet(name = 'there') { return `Hello, ${name}`; }. The parameter type is generally inferred from the default unless explicitly annotated. Interviewers test understanding of actual JavaScript behavior as well as the inferred type.
24. What are function overloads?
Overloads publish several call signatures for one implementation: function pick(x: string): string; function pick(x: number): number; function pick(x: string | number) { return x; }. The implementation must support all declared cases, and callers see the overload signatures. Interviewers want you to understand the public call contract and implementation relationship.
25. How should callback functions be typed?
Describe the arguments and return behavior expected by the caller: function each(items: string[], fn: (item: string, index: number) => void) { items.forEach(fn); }. A callback’s parameter types should follow the API contract, not assumptions about a particular caller. Interviewers test function-type literacy and safe API design.
26. What is a call signature?
A call signature describes an object that can be invoked: type Formatter = { (value: number): string; description: string };. A value of that type must be callable and have the property. Interviewers may use this to see whether you understand that functions can also be objects with members.
27. What is an index signature?
An index signature describes values accessed by a key of a given type: type Scores = { [name: string]: number };. It is broad, so use it only when arbitrary keys are part of the data model; a finite object shape or Record may be more precise. Interviewers test whether you model open-ended dictionaries deliberately.
28. What does readonly do?
readonly prevents assignment to a property through a value viewed under that type: type User = { readonly id: number; name: string };. It is a compile-time restriction, not deep immutability or a runtime freeze. Interviewers want you to distinguish a type-level write restriction from runtime guarantees.
29. How do interfaces differ from type aliases?
Both can describe object shapes. Interfaces support declaration merging and are often extended with extends; type aliases can name unions, tuples, primitives, and composed types. For example, interface User { id: number } versus type Result = User | Error. There is no universal winner: choose for the feature and conventions at hand. Interviewers test tradeoff reasoning.
30. What does implements mean on a class?
implements asks the checker to verify that a class instance conforms to a type: interface Saveable { save(): void } class Draft implements Saveable { save() {} }. It does not inject members or create runtime interface checks. Interviewers are checking the difference between a static conformance check and runtime inheritance.
31. What does extends mean for interfaces?
An interface can extend another interface to build on its members: interface Animal { name: string } interface Dog extends Animal { bark(): void }. The resulting shape includes both contracts. Interviewers are testing whether you can express shared structure without duplicating declarations.
32. How does structural typing affect assignment?
A value is generally assignable when it has the target’s required compatible members: type Named = { name: string }; const dog = { name: 'Rex', bark: true }; const n: Named = dog;. Declared inheritance is not generally required. Interviewers test whether you reason from shape and account for special checks such as fresh object literals.
33. What is a function type?
A function type specifies accepted arguments and a result: type Comparator = (a: string, b: string) => number;. It can be used for callbacks, injectable behavior, and API contracts. Interviewers are checking whether you can express behavior contracts separately from implementation.
34. How does TypeScript infer a function’s return type?
The checker derives a return type from the function’s return expressions: function square(n: number) { return n * n; } is inferred to return a number. Multiple branches contribute to the result type. An explicit annotation can catch accidental public API changes. Interviewers test inference and branch-aware reasoning.
35. How do you type a function that returns no useful value?
Use void for a function whose result is intentionally not consumed: function notify(text: string): void { console.log(text); }. A callback typed to return void can still be implemented by a function that returns a value, with that result ignored in the callback context. Interviewers may be probing this context-sensitive detail.
36. How do you type a constructor argument?
Annotate constructor parameters as ordinary parameters: class User { constructor(public name: string) {} }. Parameter properties declare and initialize an instance property as shorthand. Interviewers test understanding of how constructor syntax relates to instance shape.
37. What is a readonly array?
readonly string[] or ReadonlyArray<string> exposes an array that cannot be mutated through that reference: function first(xs: readonly string[]) { return xs[0]; }. It does not make other aliases immutable. Interviewers check whether you can accept read-only inputs to avoid unnecessary mutation.
38. What is the difference between a required and optional parameter?
A required parameter must be supplied by callers; an optional one may be omitted and is handled as possibly undefined: function find(id: number, locale?: string) {}. A parameter with a default can also be omitted. Interviewers test API ergonomics and correct absence handling.
39. What is a generic call signature on an object?
A call signature can introduce its own type parameter: type Identity = <T>(value: T) => T;. Each call can use a different T, preserving the input-output relation. Interviewers are checking that you distinguish a generic function from an object fixed to one chosen type.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →40. When should you use an interface versus a type alias?
Use the construct that expresses the required capability: an interface is convenient for extendable object contracts and declaration merging; an alias handles unions and other type expressions. type Status = 'open' | 'closed'; cannot be expressed as an interface. Interviewers value the reason for a choice more than a blanket rule.
Unions, intersections, and narrowing
41. What is a union type?
A union means a value may be one of several types: function show(x: string | number) { console.log(x); }. Before using a member specific to one constituent, narrow the value. Interviewers test whether you understand “either shape” and avoid using unavailable members.
Rank #3
42. What is an intersection type?
An intersection combines requirements: type HasId = { id: number }; type Named = { name: string }; type User = HasId & Named;. A value must meet both shapes. It differs from a union, where a value may match either constituent. Interviewers test whether you choose combination versus alternatives correctly.
43. What is type narrowing?
Narrowing uses control-flow checks to refine a broad declared type inside a point in the program. In function f(x: string | number) { if (typeof x === 'string') x.toUpperCase(); }, x is a string in the branch and remains a number in the other. Interviewers test your ability to trace what is known at each branch.
Recommended Free Tools
44. How does typeof narrow a type?
A JavaScript typeof check can distinguish primitive cases: function format(x: string | number) { if (typeof x === 'number') return x.toFixed(2); return x.toUpperCase(); }. In the first branch x is a number; after it, the remaining case is a string. Interviewers are checking the connection between runtime tests and static refinement.
45. How does the in operator narrow a union?
Checking for a property can distinguish object variants: type Fish = { swim(): void }; type Bird = { fly(): void }; function move(x: Fish | Bird) { if ('swim' in x) x.swim(); else x.fly(); }. The branch with swim has the fish shape. Interviewers test how you discriminate object unions using runtime evidence.
46. How does instanceof narrow a value?
instanceof checks a runtime prototype relationship and can narrow class instances: function size(x: Date | string) { if (x instanceof Date) return x.getTime(); return x.length; }. In the true branch, x is a Date. It is not a general validator for arbitrary object shapes. Interviewers test appropriate use of runtime checks.
47. How do equality checks narrow types?
Comparisons can remove incompatible union members: function f(x: string | null) { if (x !== null) return x.toUpperCase(); return 'missing'; }. In the first branch, x is a string. Interviewers look for careful treatment of sentinel values rather than unsafe non-null assumptions.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →48. What is a discriminated union?
It is a union whose variants share a literal property that identifies each case: type Event = { kind: 'click'; x: number } | { kind: 'key'; key: string };. A switch on kind exposes the corresponding fields. Interviewers test modeling alternatives so the checker can help enforce correct handling.
49. How do you write an exhaustive switch?
After handling every discriminant, assign the remainder to never: function assertNever(x: never): never { throw new Error('Unexpected case'); }. In a switch’s default branch, passing the remaining value to assertNever makes a newly added variant produce a type error until handled. Interviewers test maintenance-friendly control-flow reasoning.
50. What is a user-defined type predicate?
A predicate declares that a boolean-returning function narrows a value: function isString(x: unknown): x is string { return typeof x === 'string'; }. After if (isString(value)), the checker treats value as a string. The implementation must make the claim true; the annotation itself does not validate it. Interviewers test runtime guard design.
51. What is an assertion function?
An assertion function throws or otherwise fails when a condition is false and can tell the checker what follows: function assertString(x: unknown): asserts x is string { if (typeof x !== 'string') throw new Error(); }. After it returns, the value is treated as a string. Interviewers test safe boundary checks and control-flow effects.
52. How do you narrow unknown safely?
Use runtime checks before operating on it: function lengthOf(x: unknown) { if (typeof x === 'string') return x.length; return 0; }. The value begins as unknown; only the checked branch permits string operations. For nested data, validate the needed structure, not just the top-level JavaScript kind. Interviewers test safe handling of untrusted input.
53. What is a nullable union?
A nullable union explicitly permits absence, for example string | null. With strictNullChecks, check before access: if (name !== null) name.toUpperCase();. The true branch has a string. Interviewers want explicit null handling rather than relying on assumptions or compiler escape hatches.
54. How does control-flow analysis work?
The checker tracks assignments, returns, branches, and guards to refine a variable’s possible types at a location. In let x: string | number; if (typeof x === 'string') x = x.toUpperCase();, the guard informs the expression inside the branch. Interviewers are checking whether you can explain types as flow-sensitive knowledge.
55. Can a union member have extra properties?
Yes, a value may have more members than a constituent requires because compatibility is structural. For type A = { a: number }, a variable containing { a: 1, b: true } can be assignable to A; a fresh literal may trigger an excess-property check. Interviewers test the distinction between required structure and exact-object intuition.
56. What is a common property in a union?
Only properties safely available on every constituent can generally be used before narrowing. For type Shape = { kind: 'circle'; radius: number } | { kind: 'square'; side: number }, kind is common, while radius is not available until the circle case is selected. Interviewers test safe access before and after a guard.
57. How do you handle a union of functions?
A value typed as one of several function types can only be called with arguments valid for the union’s callable possibilities. Prefer a shared call signature or narrow the function variant before calling. For example, discriminating an object that contains a handler and a matching payload keeps their relationship clear. Interviewers test whether you preserve correlated types.
58. How do you narrow a value with a custom tag?
Compare the literal tag and let the checker refine the variant: if (event.kind === 'key') event.key.toUpperCase();. Given the event union from question 48, this branch has the key event and its key field. Interviewers are checking that you use explicit discriminants instead of unsafe casts.
59. What is the difference between a union and an intersection?
A union A | B accepts a value matching either alternative; an intersection A & B requires the combined constraints. For example, { id: number } | { name: string } is an alternative, while their intersection requires both properties. Interviewers test whether your model matches the data’s actual shape.
60. How do you handle an impossible branch?
Use the remaining value as never after narrowing, often via an exhaustive helper: default: return assertNever(event);. If a union member was omitted, the type error points to the unhandled case. Interviewers test how you make future changes visible to maintainers.
Rank #4
Generics and type composition
61. What is a generic?
A generic is a type parameter that lets code work across types while preserving their relationships: function identity<T>(value: T): T { return value; }. Calling it with a string returns a string type, unlike an any-based function. Interviewers test whether you can reuse code without discarding useful type information.
62. How does generic type inference work?
The checker often infers type arguments from the arguments: const result = identity('hello'); infers a string type for T. Explicit type arguments are available when inference needs guidance. Interviewers test whether you understand that generic calls can retain precise input information automatically.
63. When should you supply an explicit type argument?
Supply one when inference cannot express the intended type or when it improves clarity: const empty = Array<string>();. Do not add type arguments merely to repeat an obvious inference. Interviewers want judgment about readability and inference boundaries.
64. What is a generic constraint?
A constraint limits what types a type parameter may represent: function logLength<T extends { length: number }>(value: T) { return value.length; }. The function can use length because every permitted T has it. Interviewers test whether you constrain a generic to the operations it needs.
65. How do you constrain a key to an object’s keys?
Use K extends keyof T: function get<T, K extends keyof T>(obj: T, key: K): T[K] { return obj[key]; }. For { name: 'Ava' }, an unrelated key such as 'age' is rejected. Interviewers test preservation of the relationship among the object, key, and result.
66. What does keyof do?
keyof produces a union of an object type’s keys: type User = { id: number; name: string }; type UserKey = keyof User; yields 'id' | 'name'. It is useful for safe property access and mapped types. Interviewers test type-level operations on object structure.
67. What is indexed access type syntax?
T[K] looks up the type of a property key: type Name = User['name']; is the property’s value type. With K extends keyof T, it can express a generic lookup result. Interviewers test whether you can reuse existing type information instead of duplicating it.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →68. What is a generic interface?
A generic interface parameterizes a reusable shape: interface Box<T> { value: T }. Box<number> has a numeric value, while Box<string> has a string value. Interviewers test abstraction over data while retaining a concrete contract at use sites.
69. What is a generic default?
A type parameter may have a default used when callers omit it: interface Response<T = unknown> { data: T }. The default should be a sensible fallback, not an excuse to hide uncertainty. Interviewers test API ergonomics and safe defaults.
70. What is a mapped type?
A mapped type transforms properties from another type: type ReadonlyCopy<T> = { readonly [K in keyof T]: T[K] };. It iterates over keys and retains each corresponding value type. Interviewers are checking your understanding of reusable type transformations.
71. What is a conditional type?
A conditional type selects a type based on assignability: type IsString<T> = T extends string ? true : false;. For a concrete T, it chooses one branch; with a naked type parameter over a union, it may distribute. Interviewers test type-level branching rather than runtime conditionals.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute72. What does infer do in a conditional type?
infer introduces a type variable to extract a part of a matched type: type ReturnOf<T> = T extends (...args: never[]) => infer R ? R : never;. For a function type, R is its return type. Interviewers test type decomposition and use of conditional patterns.
73. What is Partial<T>?
Partial<T> makes each property of T optional: type Patch = Partial<User>;. It is useful for partial updates but does not itself validate a patch at runtime or define merge semantics. Interviewers test awareness of both utility and limits.
74. What is Required<T>?
Required<T> removes optional modifiers from properties: type Complete = Required<Options>;. It changes the static view and does not fill in missing runtime fields. Interviewers test whether you distinguish type transformation from data transformation.
75. What are Pick<T, K> and Omit<T, K>?
Pick retains selected properties; Omit removes selected properties. For example, type PublicUser = Pick<User, 'id' | 'name'>; describes a subset. These are compile-time type tools, not runtime object filters. Interviewers test practical composition and the static/runtime boundary.
Free tools Windows power users keep installed
One-click scans. No signup required.
76. What is Record<K, V>?
Record<K, V> describes an object mapping keys of type K to values of type V: type Flags = Record<'dark' | 'compact', boolean>;. A finite key union makes the intended key set clearer than an unrestricted string index. Interviewers test dictionary modeling.
77. What does ReturnType<T> do?
ReturnType<T> extracts a function type’s result type: type Result = ReturnType<typeof makeUser>;. It is useful when another declaration should track an existing function’s return contract. Interviewers test type reuse and the distinction between a value’s type and a type name.
78. What is a generic type parameter’s scope?
A type parameter belongs to the generic declaration that introduces it. type Identity = <T>(x: T) => T; lets each call choose a new T; interface Holder<T> { value: T } fixes the type for each holder instance. Interviewers test the difference between per-call and per-instance abstraction.
79. How do you preserve a relationship between inputs and outputs?
Represent the relationship with a shared generic parameter: function wrap<T>(value: T): { value: T } { return { value }; }. For a string input, the result contains a string rather than an erased any. Interviewers test whether your abstraction carries information through an API.
Recommended Free Tools
Best Value
80. What is a distributive conditional type?
A conditional type distributes over a union when its checked type is a naked type parameter: type ToArray<T> = T extends unknown ? T[] : never;. For string | number, it becomes string[] | number[]. Wrapping the checked type, such as [T] extends [unknown], suppresses distribution. Interviewers test advanced type composition.
Classes, modules, and project settings
81. What is the difference between a class’s instance side and static side?
The instance side describes objects created with new; the static side describes the constructor value and static members. class User { static kind = 'user'; name = ''; } has kind on the class value and name on instances. Interviewers test whether you understand that these are distinct types.
82. What do public, private, and protected mean?
They control access in TypeScript’s class type-checking: private restricts access to the declaring class, while protected also permits subclasses. TypeScript’s modifier behavior should not automatically be equated with JavaScript runtime privacy; JavaScript #private fields provide a runtime language mechanism. Interviewers test both type-level and runtime distinctions.
83. What is an abstract class?
An abstract class cannot be directly instantiated and can require subclasses to implement members: abstract class Shape { abstract area(): number }. It can also provide shared implementation. Interviewers test when a base class is useful compared with an interface-only contract.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
84. What are declaration files?
Declaration files, commonly ending in .d.ts, describe types for JavaScript code or packages without supplying those implementations: declare function legacy(value: string): number;. Their declarations must accurately match runtime behavior. Interviewers test how TypeScript can type existing JavaScript libraries.
85. What do imports and exports do?
They define module boundaries and expose or consume values and types: export type User = { id: number }; can be imported as a type. The emitted module behavior depends on compiler settings and the runtime or bundler. Interviewers test whether you separate source-level syntax from module loading.
86. What is the difference between a type-only import and a value import?
import type { User } from './user'; marks an import used only for types, while a regular import may refer to a runtime value. Type-only imports are erased from JavaScript output. Interviewers test whether you understand what must exist at runtime and how to avoid accidental value imports.
87. What does tsconfig.json configure?
It defines compiler options and the project’s file scope, including choices such as strictness, target, module behavior, and included files. For example, strict changes checking, while target affects emitted JavaScript syntax. Interviewers test awareness that project behavior is configured, not universal.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems88. What is the difference between target and module?
target controls the JavaScript language level emitted; module controls module-related output and resolution behavior. Their supported values and effects depend on the compiler version and environment. Interviewers test whether you can configure for a runtime rather than recite a one-size-fits-all setting.
89. What is module resolution?
Module resolution is how TypeScript finds the file or package behind an import. It is configured to match an ecosystem such as Node.js or a bundler, and the correct choice depends on how the application runs. Interviewers test whether source imports, compiler resolution, and runtime resolution are aligned.
90. What is the difference between the TypeScript compiler and a bundler?
The compiler checks types and can emit JavaScript; a bundler combines and processes modules and assets for an application. Some toolchains use a fast transpiler or bundler for output and run TypeScript checking separately. Interviewers test whether you know that successful bundling does not necessarily mean type checking occurred.
91. Does TypeScript validate JSON received from an API?
No. A declaration such as const user = JSON.parse(text) as User; only tells the checker to trust the claim; it does not inspect the JSON. Treat external data as unknown and validate its required structure before use. Interviewers test whether you locate runtime validation at trust boundaries.
92. What version-specific TypeScript changes should you mention in an interview?
Name the compiler version when discussing a feature or behavior that can change. The TypeScript 5.9 release announcement, dated August 1, 2025, highlighted a revised minimal tsc --init, import defer, --module node20, and possible type-argument inference changes that could expose errors. That announcement is historical context, not evidence of the latest release in October 2026. Interviewers test your habit of qualifying version-sensitive claims.
Practical interview scenarios
93. How would you model an API request state?
Use a discriminated union so each state has only its relevant data: type State = { status: 'loading' } | { status: 'error'; message: string } | { status: 'success'; data: User };. A switch on status narrows the available fields. Interviewers are testing whether your model prevents invalid combinations, not just whether it compiles.
94. Where should runtime validation happen?
Validate where data crosses a trust boundary, such as parsed JSON, user input, or an external message. A type declaration does not establish that a value from outside the program matches it. After validation, expose a typed result to the rest of the application. Interviewers test whether you combine static types with runtime evidence.
95. How would you make a reusable function preserve its input type?
Use a generic rather than any: function first<T>(items: readonly T[]): T | undefined { return items[0]; }. Given numbers, the result is number-or-undefined; given strings, it is string-or-undefined. Interviewers test whether the API carries element information through its result.
Recommended Free Tools
96. How would you explain a property-access compiler error on a union?
Check the declared union and identify which members guarantee that property. If it belongs to only one case, add a runtime discriminant check and access it in the narrowed branch. For example, a key field on a key event is unavailable until event.kind === 'key'. Interviewers test diagnostic reasoning, not reflexive use of assertions.
97. How would you handle a function argument that may be several shapes?
Model the alternatives as a union, then narrow with a reliable tag or runtime guard: type Input = { kind: 'id'; id: number } | { kind: 'name'; name: string };. A branch on kind gives the matching fields. Interviewers test whether your API makes valid cases explicit.
98. How would you choose between a union and an optional-property object?
Use a union when the cases have distinct meanings or mutually dependent fields; use optional properties when members are genuinely independent and may be omitted. A tagged union can prevent impossible combinations such as a success state without data. Interviewers test modeling judgment based on domain invariants.
99. How do you respond when stricter compiler settings reveal errors?
Read the first diagnostic in context, determine which assumption is no longer established, and handle the case explicitly or correct the type model. Do not silence a cluster with any or assertions before understanding the invariant. Interviewers are testing debugging discipline and whether strictness improves the design.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →100. How should you prepare for a TypeScript interview?
Practise explaining code, not just definitions: state a value’s broad type, show the check that narrows it, and identify what still requires runtime validation. Be ready to discuss project settings and version-sensitive behavior in the context of the codebase. Interviewers are assessing how you reason about safe, maintainable software—not the number of definitions you can recite.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




