Questions

TypeScript questions

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

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.

typescript

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.

typescript

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.

typescripttslint

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.

typescriptjson

How to Import SVG Files in TypeScript and TSX

Learn why TypeScript cannot import SVG files by default and how to fix it in TSX with module declarations and practical examples.

typescriptsvg

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.

typescriptangularobject

How to Loop Through Enum Values in TypeScript

Learn how TypeScript enums work and how to loop through enum values without getting reverse-mapped numeric keys.

typescriptjavascriptarraysenums

How to Parse a JSON String in TypeScript

Learn how to parse JSON strings in TypeScript with JSON.parse(), type the result safely, validate unknown data, and handle invalid JSON.

typescriptjavascriptjsonstring

How to Pass Data to Angular Routed Components

Learn practical ways to pass data to Angular routed components using route params, query params, navigation state, and shared services.

typescriptangular

How to Reject a Promise in async/await with TypeScript

Learn how to reject promises correctly in async/await TypeScript code using throw, try/catch, and proper error handling patterns.

typescriptjavascriptasynchronouses6-promise

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.

typescriptarrayscollections

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.

typescriptnode.js

How to Select an Element in an Angular Component Template

Learn how to access template elements in Angular using template reference variables, @ViewChild, and ElementRef with clear examples.

typescriptangularangular-components

How to Set Default Values for Object Parameters in TypeScript

Learn how to set default values for object parameters in TypeScript using destructuring, optional properties, and safe fallback patterns.

typescriptarguments

How to Type Dates in TypeScript

Learn the correct way to type dates in TypeScript, when to use Date, and how it differs from strings and timestamps.

typescriptdate

How to Type Function Callbacks in TypeScript Interfaces

Learn how to define callback function types in TypeScript interfaces using proper function signatures instead of any.

typescript

How to Type Object Literal Properties in TypeScript

Learn how to declare types for object literal properties in TypeScript, why `property: string` fails, and the correct syntax to use.

typescript

How to Type an Array of Objects in TypeScript

Learn how to declare and type an array of objects in TypeScript, with inline types, interfaces, and safe property access examples.

typescript

How to Type the children Prop in React with TypeScript

Learn how to type the React children prop in TypeScript, why ReactNode can cause JSX errors, and how to fix functional components correctly.

typescriptreactjsjsxtypescript2.0

How to Use async/await with Array.map in TypeScript

Learn why Array.map with async returns Promise[] in TypeScript and how to fix it using Promise.all with clear examples.

typescriptjavascriptpromiseasync-await

Page 5 of 9 - 162 questions