Questions
TypeScript questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Create an Object from an Interface in TypeScript
Learn how to use a TypeScript interface to describe an object and correctly create and initialize that object in practice.
How to Declare Nullable Types in TypeScript Interfaces
Learn how to make properties nullable in TypeScript interfaces using union types, optional fields, and null-safe patterns.
How to Define an Array with Multiple Types in TypeScript
Learn how to type arrays with mixed values in TypeScript using union types and tuples, with examples, pitfalls, and practical use cases.
How to Dynamically Assign Properties to an Object in TypeScript
Learn how to add dynamic properties to objects in TypeScript using index signatures, Record, type assertions, and safe typing patterns.
How to Enforce String Values in Indexed TypeScript Objects
Learn how to type indexed objects in TypeScript so string keys only map to string values using index signatures and Record.
How to Exclude a Property from a Type in TypeScript
Learn how to exclude one property from a type in TypeScript using Omit, Pick, and mapped types with clear examples.
How to Extend Types in TypeScript
Learn how to extend types in TypeScript using intersections and interfaces, with examples, mistakes, and real project patterns.
How to Fix "Cannot use JSX unless the '--jsx' flag is provided" in TypeScript React
Learn why TypeScript shows the JSX flag error in TSX files and how to fix tsconfig, file inclusion, and project setup correctly.
How to Fix "Unknown file extension .ts" in TypeScript on Heroku
Learn why Heroku shows "Unknown file extension .ts" and how to fix ts-node, ESM, CommonJS, and TypeScript runtime setup.
How to Fix 'No Provider for HttpClient' in Angular
Learn why Angular shows 'No provider for HttpClient' and how to fix module imports, dependency injection, and casing issues correctly.
How to Generate a tsconfig.json File in TypeScript
Learn how to create a tsconfig.json file from the command line in TypeScript, what it does, and how to use it in real projects.
How to Get Enum Entry Names in TypeScript
Learn how to get enum entry names in TypeScript, iterate enums safely, and avoid reverse-mapping pitfalls with clear examples.
How to Get the Selected Value from a Select in Angular 2
Learn how to read the new selected option from a select element in Angular 2 using ngModel, change events, and ngModelChange.
How to Handle Optional Parameters in TypeScript When Skipping Earlier Arguments
Learn how optional parameters work in TypeScript and how to pass later values when skipping earlier optional arguments.
How to Handle TS2533: Object Is Possibly 'null' or 'undefined' in TypeScript
Learn why TypeScript shows TS2533 for possibly null or undefined values and how to fix it safely with checks, assertions, and better types.
How to Ignore TypeScript Errors: @ts-ignore, File-Level Alternatives, and Safer Patterns
Learn how @ts-ignore works in TypeScript, why it only affects one line, and the safe alternatives for larger code blocks or files.
How to Import JSON in TypeScript and Use Typed Properties
Learn how to import JSON files in TypeScript, why property errors happen, and how to fix JSON imports in TS and TSX files correctly.
How to Iterate Over Object Keys and Values with *ngFor in Angular
Learn how to loop through object keys and values in Angular using *ngFor and the keyvalue pipe, with examples and common mistakes.
How to Remove an Array Item in TypeScript
Learn how to remove an item from a TypeScript array by key using findIndex, filter, and splice with clear examples and common mistakes.
How to Run TypeScript Files from the Command Line
Learn how to run TypeScript files from the command line using tsc, ts-node, and Node.js with practical examples and common pitfalls.