Questions
TypeScript questions
Choose a question page, learn the concept, then test your understanding with a quiz.
TypeScript Arrow Functions with Generics: Syntax and Examples
Learn the syntax for generic arrow functions in TypeScript with clear examples, pitfalls, and practical usage in real code.
TypeScript Class Initialization and Field Initializers
Learn how to initialize TypeScript classes, set fields, and use constructors or object assignment instead of C#-style object initializers.
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.
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.
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.
TypeScript Function Overloading Explained
Learn how TypeScript function overloading works, why duplicate identifier errors happen, and how to write correct overloads with examples.
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 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.
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 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 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.
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.
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.
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.
Typing React onChange Event.target.value in TypeScript
Learn how to correctly type React input onChange events in TypeScript without using any, including event types and reusable props.
Understanding "JSX element type does not have any construct or call signatures" in React and TypeScript
Learn why this React TypeScript JSX error happens and how to type component props correctly with practical examples and fixes.
Understanding "not assignable to parameter of type never" in TypeScript
Learn why TypeScript infers `never[]` for empty arrays and how to fix the "not assignable to parameter of type never" error.
Understanding .d.ts Declaration Files in TypeScript
Learn what .d.ts files do in TypeScript, how they relate to .ts and .js files, and when you can use declaration files instead of source code.
Understanding TS18003: No Inputs Were Found in tsconfig.json for TypeScript Builds
Learn why TS18003 happens in tsconfig.json, how include and exclude work, and how to fix missing TypeScript input files in builds.
Understanding Type 'string | undefined' Is Not Assignable to Type 'string' in TypeScript
Learn why optional properties become string | undefined in TypeScript and how to handle them safely with checks, defaults, and assertions.