LearnThatStack Ace your next interview
Frontend Development

TypeScript.

Start free Change topic Change
Practice · Questions

All questions

Showing of 102
Beginner 18
01

What are the main benefits of using TypeScript over JavaScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

TypeScript adds static types to JavaScript, so the compiler catches many bugs before the code runs, not in production. The benefits follow from that:

  • A misspelled property or a wrong argument type fails the type check instead of crashing for a user.
  • Editors use the types for autocomplete, inline documentation and safe renames.
  • Type annotations document what each function takes and returns, and the compiler keeps that documentation accurate.
  • Changing a signature makes the compiler list every caller that breaks, so refactoring is safer.
  • Interfaces give a team clear contracts between modules.
  • You can write modern ECMAScript features, and the compiler can emit older JavaScript for older runtimes.

The cost is a build step and a learning curve. Types also vanish at runtime, so API data still needs checking.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

How do you compile TypeScript code?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

You compile TypeScript with tsc, the TypeScript compiler. It type-checks your .ts files and emits plain .js files that run in any JavaScript environment.

# Install TypeScript globally
npm install -g typescript

# Compile a single file
tsc app.ts

# Compile with watch mode
tsc app.ts --watch

# Compile using tsconfig.json
tsc

Running tsc with no file names finds the nearest tsconfig.json and compiles the whole project with its settings. Naming a file, as in tsc app.ts, compiles just that file with default options. Since TypeScript 6.0 that is an error when a tsconfig.json is present, unless you add --ignoreConfig. Adding --watch recompiles whenever a file changes.

In many projects tsc only type-checks. A bundler such as Vite strips the types and builds the output, and tsc --noEmit runs separately as the type check. Node.js can also run a .ts file directly by stripping its types, but it does no type checking at all.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

What is type inference in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Type inference means TypeScript works out a type from the code itself, so you don't have to write an annotation. A variable gets the type of its initial value, and a function's return type comes from what it returns.

let message = "Hello"; // TypeScript infers string type
let count = 42; // TypeScript infers number type
let isActive = true; // TypeScript infers boolean type

function add(a: number, b: number) {
  return a + b; // Return type inferred as number
}

Inference keeps code short and still fully typed. Parameters are the main exception. Under strict, a parameter needs an annotation unless it has a default value or gets its type from context, as a callback does.

A let infers a wider type than a const: let x = "a" is string, but const y = "a" is the literal type "a".

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

What are type annotations and how do you use them?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Type annotations are explicit types you write after a colon, as in let age: number. They tell TypeScript what type a variable, parameter or return value must have, and the compiler rejects any value that doesn't fit.

// Variable annotations
let username: string = "john";
let age: number = 25;
let isLoggedIn: boolean = false;

// Function parameter and return type annotations
function greet(name: string): string {
  return `Hello, ${name}!`;
}

// Array annotations
let numbers: number[] = [1, 2, 3];
let names: Array<string> = ["Alice", "Bob"];

Array types take either form, and string[] means the same as Array<string>.

In practice you annotate function parameters and often return types. You let type inference handle most local variables, because an annotation that repeats an obvious initial value adds nothing.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

What are the primitive types in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

TypeScript has a type for each of JavaScript's seven primitives, the values that are not objects:

  • string for text.
  • number for numeric values, integers and floats alike.
  • boolean for true and false.
  • null for an intentional absence of a value.
  • undefined for a value that was never assigned.
  • symbol for unique identifiers.
  • bigint for integers too large for number.

TypeScript also adds special types that are not primitives. void marks a function that returns nothing, and never marks a value that never occurs. any turns off type checking, and unknown is its type-safe alternative.

Write the lowercase names, because String and Number refer to wrapper objects.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

What is an interface in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An interface names the shape of an object: which properties and methods it has, and the type of each. Any object with that shape is accepted, whatever created it, because TypeScript compares structure, not names.

interface User {
  id: number;
  name: string;
  email: string;
  isActive?: boolean; // Optional property
  readonly createdAt: Date; // Read-only property
}

const user: User = {
  id: 1,
  name: "John Doe",
  email: "john@example.com",
  createdAt: new Date()
};

A ? marks an optional property, and readonly blocks reassignment after the object is created. Interfaces exist only at compile time and emit no JavaScript. One interface can extend another, and a class uses the implements keyword to promise it has that shape.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

How do you extend interfaces in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Use the extends keyword. The new interface gets every property of the one it extends and adds its own, so a Circle has both color and radius.

interface Shape {
  color: string;
}

interface Circle extends Shape {
  radius: number;
}

// Multiple inheritance
interface TimestampedShape extends Shape, Timestamped {
  area: number;
}

interface Timestamped {
  createdAt: Date;
  updatedAt: Date;
}

An interface can extend several interfaces at once, separated by commas, as TimestampedShape does. If two parents declare the same property with incompatible types, the compiler reports an error instead of picking one. Declaration order doesn't matter, which is why Timestamped can appear after the interface that uses it.

The alternative is an intersection of type aliases with &. An interface that extends creates one flat type that reports property conflicts. The compiler also caches checks between interfaces, so extends is the better default for object shapes.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

What are optional properties and how do you define them?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An optional property is one an object may leave out. You mark it with ? after the name, and its type becomes the declared type or undefined.

interface Config {
  apiUrl: string;
  timeout?: number; // Optional
  retries?: number; // Optional
  debug?: boolean; // Optional
}

const config: Config = {
  apiUrl: "https://api.example.com"
  // Other properties can be omitted
};

When you read config.timeout, its type is number | undefined, so the compiler makes you handle the missing case. Use ?? to supply a default value, or ?. to read deeper into a property that may be missing.

Function parameters can be optional with the same ?, as long as they come after the required ones.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

09

What are readonly properties in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

A readonly property can be set when the object is created, or inside a class constructor, and never reassigned after that. The compiler rejects any later assignment.

interface Point {
  readonly x: number;
  readonly y: number;
}

const point: Point = { x: 10, y: 20 };
// point.x = 30; // Error: Cannot assign to 'x' because it is read-only

// Readonly arrays
const readonlyArray: readonly number[] = [1, 2, 3];
// readonlyArray.push(4); // Error: Property 'push' does not exist

// ReadonlyArray type
const numbers: ReadonlyArray<number> = [1, 2, 3];

For arrays, readonly number[] and ReadonlyArray<number> remove methods that change the array, such as push. Readonly<T> makes every property of a type read-only at once.

The check is compile-time only, and nothing freezes the object at runtime. It is also shallow: a readonly property that holds an object still lets you change that object's fields.

const is different, because it stops a variable from being reassigned, while readonly applies to properties.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

10

How do you define a class in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

You write a class with the class keyword, as in JavaScript, and add types to its fields, constructor parameters and methods. Under strict mode, TypeScript also reports a field that is declared but never set, by an initializer or in the constructor.

class Person {
  private _id: number;
  protected name: string;
  public email: string;

  constructor(id: number, name: string, email: string) {
    this._id = id;
    this.name = name;
    this.email = email;
  }

  public greet(): string {
    return `Hello, I'm ${this.name}`;
  }

  protected getId(): number {
    return this._id;
  }
}

Members can carry the public, protected or private access modifiers, and public is the default.

Parameter properties shorten the common case. constructor(private id: number) {} declares the field and assigns it in one step.

A class can inherit from one base class with extends, and promise to match any number of interfaces with implements.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

11

What are access modifiers in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Access modifiers control where a class member can be used. TypeScript has three, and a member is public unless you say otherwise.

  • public members are accessible everywhere.
  • private members are accessible only inside the class that declares them.
  • protected members are accessible inside the class and its subclasses, but not from outside.
class BankAccount {
  private balance: number;
  protected accountType: string;
  constructor(accountNumber: string, initialBalance: number) {
    this.balance = initialBalance;
    this.accountType = "savings";
  }
}
class PremiumAccount extends BankAccount {
  constructor(accountNumber: string, initialBalance: number) {
    super(accountNumber, initialBalance);
    // this.balance; // Error: private property
    console.log(this.accountType); // OK: protected property
  }
}

The compiler checks the modifiers only at compile time. The emitted JavaScript has ordinary properties, so private data can still be reached at runtime with bracket access or plain JavaScript. For privacy the runtime enforces, use a # private field such as #balance.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

12

How do ES6 modules work in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

A file with a top-level import or export is an ES6 module with its own scope. export makes a name visible to other files, and import brings it in. A file with neither is treated as a global script instead.

// math.ts
export function add(a: number, b: number): number {
  return a + b;
}
export function subtract(a: number, b: number): number {
  return a - b;
}
export default function multiply(a: number, b: number): number {
  return a * b;
}

export const PI = 3.14159;

// app.ts
import multiply, { add, subtract, PI } from './math';
import * as MathUtils from './math';

console.log(add(5, 3)); // 8
console.log(multiply(4, 2)); // 8
console.log(MathUtils.PI); // 3.14159

A module can have any number of named exports, imported in braces. It has at most one default export, imported without braces under any name you choose. import * as MathUtils gathers every named export into one object.

TypeScript adds type-only imports. import type { User } from './types' is removed from the output, so it never loads the module at runtime. The module and moduleResolution settings in tsconfig.json decide which syntax the compiler emits and how it finds ./math.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

13

How do you handle errors in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

You handle errors with JavaScript's try and catch. Under strict, TypeScript types the caught value as unknown, because JavaScript can throw anything, not only Error objects. You narrow it before you use it.

function parseNumber(value: string): number {
  try {
    const parsed = parseInt(value);
    if (isNaN(parsed)) {
      throw new Error(`Invalid number: ${value}`);
    }
    return parsed;
  } catch (error) {
    if (error instanceof Error) {
      console.error(error.message);
    }
    throw error;
  }
}
// Custom error types
class ValidationError extends Error {
  constructor(
    message: string,
    public field: string,
    public value: any
  ) {
    super(message);
    this.name = 'ValidationError';
  }
}

The instanceof Error check narrows error, so error.message compiles. The useUnknownInCatchVariables option, part of strict, sets that default. Without it the variable is any, and the compiler checks nothing.

Custom error classes extend Error and add typed fields, like field and value on ValidationError. Setting name makes logs show which error it was. A caller can test err instanceof ValidationError and then read err.field safely.

TypeScript does not track which errors a function throws, so document them, or return a result type for failures callers must handle.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

14

How do you stay updated with TypeScript evolution?

Part of Pro
15

What advice would you give to someone learning TypeScript?

Part of Pro
16

What are your thoughts on TypeScript's future and ecosystem?

Part of Pro
17

What are enums in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An enum is a named set of constants, such as a set of account statuses. Unlike most TypeScript features, it exists at runtime. The compiler turns it into a real JavaScript object.

enum Status {
  Active = "ACTIVE",
  Disabled = "DISABLED",
}
function setStatus(s: Status) {}
setStatus(Status.Active); // OK
// setStatus("ACTIVE");   // Error: a string is not a Status

type StatusUnion = "ACTIVE" | "DISABLED";
function setStatusUnion(s: StatusUnion) {}
setStatusUnion("ACTIVE"); // OK, and no runtime object exists

Numeric enums count up from 0 and also map values back to names. String enums hold readable values, and they have no reverse mapping.

A union of string literals gives the same compile-time safety with no runtime code, and its values are plain strings. Use an enum when you need a runtime object to iterate over or look values up in.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

18

What is the difference between arrays and tuples in TypeScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An array holds any number of values of one type, while a tuple has a fixed length and its own type at each position. So number[] is an array type, and [string, number] is a tuple type.

const scores: number[] = [90, 85, 77]; // any length, all numbers
scores.push(100);                      // fine

const entry: [string, number] = ["alice", 90];
const user = entry[0];                 // string
const score = entry[1];                // number
// const bad: [string, number] = [90, "alice"]; // Error: wrong order

type Point = readonly [x: number, y: number]; // labeled and read-only

Tuples suit small, positional data, such as a function that returns two values. React's useState returns a value and a setter this way. For more than two or three fields, an object type with named properties is clearer.

Labels like x and y document what each position means. An optional element makes a tuple's length vary, and a rest element lets it grow.

A tuple is still an array at runtime, so push can add elements unless the tuple is readonly.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

Intermediate 57
19

What does the NonNullable utility type do in TypeScript?

Intermediate ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

NonNullable<T> removes null and undefined from a type. NonNullable<string | null | undefined> is just string, which is the type a value has after a null check.

type MaybeString = string | null | undefined;
type DefinitelyString = NonNullable<MaybeString>; // string

function processValue(value: string | null | undefined): void {
  if (value !== null && value !== undefined) {
    // Type narrowing
    const processed: NonNullable<typeof value> = value; // string
    console.log(processed.toUpperCase());
  }
}

// Useful with arrays
type ArrayItem<T> = T extends (infer U)[] ? NonNullable<U> : never;
type StringArrayItem = ArrayItem<(string | null)[]>; // string

For a union, it drops the null and undefined members and keeps the rest. Inside a function, NonNullable<typeof value> names the narrowed type of a parameter. The last two lines use it inside a conditional type to clean up an array's element type.

It changes only the type, never the value. To remove nulls from data you still need a runtime check, and NonNullable then describes what is left.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

20

What is the difference between any and unknown types?

Part of Pro
21

Explain union types and intersection types

Part of Pro
22

What are literal types in TypeScript?

Part of Pro
23

How do you handle nullable types in TypeScript?

Part of Pro
24

What is type assertion and when should you use it?

Part of Pro
25

What's the difference between interface and type in TypeScript?

Part of Pro
26

How do you define function types in interfaces?

Part of Pro
27

What are index signatures in TypeScript?

Part of Pro
28

How does inheritance work in TypeScript?

Part of Pro
29

What are abstract classes in TypeScript?

Part of Pro
30

How do you implement interfaces in classes?

Part of Pro
31

What are static methods and properties in TypeScript?

Part of Pro
32

What are getters and setters in TypeScript?

Part of Pro
33

What are generics in TypeScript and why are they useful?

Part of Pro
34

How do you define generic interfaces?

Part of Pro
35

What are generic constraints in TypeScript?

Part of Pro
36

How do you create generic classes?

Part of Pro
37

What is the keyof operator in TypeScript?

Part of Pro
38

What are discriminated unions in TypeScript?

Part of Pro
39

What is type narrowing in TypeScript?

Part of Pro Visual
40

What are type guards in TypeScript?

Part of Pro
41

What is the never type in TypeScript?

Part of Pro
42

What are namespaces in TypeScript?

Part of Pro
43

What's the difference between namespaces and modules?

Part of Pro
44

How do you handle module resolution in TypeScript?

Part of Pro
45

What are utility types in TypeScript?

Part of Pro
46

Explain the Record utility type in TypeScript

Part of Pro
47

What do the ReturnType and Parameters utility types do?

Part of Pro Visual
48

How do you use Exclude<T, U> and Extract<T, U>?

Part of Pro Visual
49

How do you debug TypeScript code?

Part of Pro
50

What is strict mode in TypeScript?

Part of Pro
51

What is tsconfig.json and what are its important options?

Part of Pro
52

How do you configure TypeScript for different environments?

Part of Pro
53

What are TypeScript declaration files (.d.ts)?

Part of Pro
54

How do you integrate TypeScript with build tools?

Part of Pro
55

What are TypeScript coding best practices?

Part of Pro
56

How do you handle gradual TypeScript adoption?

Part of Pro
57

What are common TypeScript anti-patterns to avoid?

Part of Pro
58

What are effective TypeScript testing strategies?

Part of Pro
59

How does TypeScript work with React?

Part of Pro
60

How do you type React event handlers?

Part of Pro
61

How does TypeScript work with Node.js?

Part of Pro
62

How do you handle async/await with TypeScript?

Part of Pro
63

How do you handle API responses with TypeScript?

Part of Pro
64

How do you implement type-safe form validation?

Part of Pro
65

How do you handle state management with TypeScript?

Part of Pro
66

How do you implement real-time features with TypeScript?

Part of Pro
67

What are some common TypeScript gotchas?

Part of Pro
68

How do you handle TypeScript in a team environment?

Part of Pro
69

What are your favorite TypeScript utility types and why?

Part of Pro
70

What TypeScript patterns do you use for error handling?

Part of Pro
71

How do you use the satisfies operator in TypeScript?

Part of Pro
72

What is structural typing in TypeScript?

Part of Pro
73

How does function overloading work in TypeScript?

Part of Pro
74

What is declaration merging in TypeScript?

Part of Pro
75

What are indexed access types in TypeScript?

Part of Pro
Expert 27
76

What are conditional types in TypeScript?

Part of Pro
77

What are mapped types in TypeScript?

Part of Pro
78

Explain template literal types in TypeScript

Part of Pro
79

What are decorators in TypeScript?

Part of Pro
80

What are class decorators in TypeScript?

Part of Pro Visual
81

How do property decorators work?

Part of Pro
82

What are assertion functions in TypeScript?

Part of Pro
83

How do you optimize TypeScript compilation performance?

Part of Pro
84

How do you structure large TypeScript projects?

Part of Pro
85

How do you implement builder patterns with TypeScript?

Part of Pro
86

What are higher-order types in TypeScript?

Part of Pro
87

How do you implement type-safe event systems?

Part of Pro
88

What are phantom types in TypeScript?

Part of Pro Visual
89

How do you implement functional programming patterns with TypeScript?

Part of Pro
90

How do you optimize TypeScript bundle size?

Part of Pro
91

What are the performance implications of different TypeScript features?

Part of Pro Visual
92

How do you implement dependency injection with TypeScript?

Part of Pro
93

How do you ensure type safety in large codebases?

Part of Pro
94

How do you handle type migrations in evolving APIs?

Part of Pro
95

How do you use TypeScript in microservices architecture?

Part of Pro
96

What would you consider when migrating a large JavaScript project to TypeScript?

Part of Pro
97

What are the most challenging TypeScript concepts you've worked with?

Part of Pro
98

How do you debug complex TypeScript type errors?

Part of Pro
99

How do you implement design patterns with TypeScript?

Part of Pro
100

How do you handle performance optimization in TypeScript applications?

Part of Pro
101

How do you use const assertions and template literal types?

Part of Pro
102

What are covariance and contravariance in TypeScript?

Part of Pro Visual

No matches

Try a different filter or search term.

Know someone prepping for TypeScript? Send them this set.
Quick recap

TypeScript in pictures.

A quick recap of TypeScript in 42 short animated pictures, one idea at a time. About 11 min to get the whole topic back in your head before you walk in. Pause any picture, slow it down, or step through it.

Pro The first chapter is free to play. The other 37 pictures come with Pro.

Get Pro · $10/mo
Pro · $10/mo

86 of 102 TypeScript answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git