Questions

TypeScript questions

Choose a question page, learn the concept, then test your understanding with a quiz.

TypeScript Constructor Overloading: How to Use Overload Signatures Correctly

Learn how constructor overloading works in TypeScript using overload signatures and a single implementation with clear examples.

typescriptconstructoroverloading

TypeScript Dictionary Initialization and Structural Type Checking Explained

Learn why a TypeScript dictionary may accept invalid-looking values and how structural type checking works with object literals.

typescriptdictionaryinitialization

TypeScript Dictionary Objects: How to Type Key-Value Objects

Learn how to type dictionary-style objects in TypeScript using index signatures, Record, and when to use objects vs arrays.

typescriptarraysobjectdictionary

TypeScript Function Overloading Explained

Learn how TypeScript function overloading works, why duplicate identifier errors happen, and how to write correct overloads with examples.

typescriptoverloading

TypeScript Getters and Setters: How to Use get and set Correctly

Learn how getters and setters work in TypeScript, including syntax, examples, common mistakes, and how to define property accessors correctly.

typescript

TypeScript Index Signatures vs Mapped Types with Enums

Learn why TypeScript index signatures cannot use enum unions and how to fix it with mapped types and Record objects.

typescriptjavascript

TypeScript Indexed Access Types: Get a Value Type from a Key

Learn how to get a property value type from a key in TypeScript using generics and indexed access types like T[K].

typescript

TypeScript Interface Default Values and Optional Properties

Learn why TypeScript interfaces cannot set runtime defaults, how optional properties work, and safer patterns for initializing objects later.

typescript

TypeScript Non-Null Assertion Operator (!) Explained

Learn what the TypeScript non-null assertion operator (!) does, how it works, when to use it, and safer alternatives with examples.

typescript

TypeScript Object Indexing with String Keys and keyof

Learn why TypeScript rejects string object indexing and how to safely use keyof, Record, and type guards for dynamic keys.

typescriptjavascript

TypeScript Optional Parameters: What Does the Question Mark Mean?

Learn what the question mark means in TypeScript parameters, how optional values work, and how to safely use defaults in constructors.

typescript

TypeScript String Enums: Create Enums with String Values

Learn how to create TypeScript string enums, access their values, validate inputs, and avoid common enum mistakes with practical examples.

typescriptenums

TypeScript String Literal Union Types in Interfaces

Learn how to restrict an interface property to specific string values with TypeScript string literal union types and practical examples.

typescript

TypeScript Types in Object Destructuring

Learn how to type object destructuring in TypeScript, why colons rename properties, and how to annotate destructured values correctly.

typescriptdestructuring

TypeScript `is` Keyword: Type Predicates and Type Guards

Learn how TypeScript `arg is Type` predicates narrow values, write safe custom type guards, and use them in filters and validation.

typescriptkeyword

TypeScript export vs default export: What’s the Difference?

Learn the difference between export and default export in TypeScript, how imports work, and why TS1192 happens in real projects.

typescriptjavascriptecmascript-6

TypeScript keyof: Safely Index Objects with Dynamic Keys

Learn how to fix TypeScript implicit any index errors with noImplicitAny using keyof, typed keys, and safe dynamic object access.

typescript

TypeScript setTimeout Return Type: Node vs Window Explained

Learn why TypeScript resolves setTimeout differently in Node and browsers, and how to use the correct return type safely.

typescriptsettimeout

TypeScript tsconfig Paths: How Path Mapping Works with Webpack

Learn how to use tsconfig.json paths in TypeScript, when baseUrl is needed, and how to make path aliases work with Webpack.

typescriptnode-modulestsconfig

TypeScript unknown vs any: Differences, Safety, and When to Use Each

Learn the difference between TypeScript unknown and any, when to use each, and how unknown improves type safety in real code.

typescripttypescript3.0

Page 7 of 9 - 162 questions