Questions

TypeScript questions

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

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

How to Watch and Reload ts-node When TypeScript Files Change

Learn how to watch TypeScript files and automatically restart a ts-node dev server using practical tools and examples.

typescriptdevelopment-environmentnodemon

Interfaces vs Type Aliases in TypeScript

Learn the difference between interface and type in TypeScript, when to use each, and how they behave in real codebases.

typescriptinterfacetypescript-types

JSX.Element vs ReactNode vs ReactElement in React TypeScript

Learn the difference between JSX.Element, ReactNode, and ReactElement in React TypeScript, including null returns and component typing.

typescriptjavascriptreactjs

Optional Chaining in TypeScript: Does TypeScript Support `?.` and What Is It Called?

Learn whether TypeScript supports the `?.` operator, what it is called, how it works, and how to use optional chaining safely in TypeScript.

typescript

Runtime Interface Type Checks in TypeScript: Why `instanceof` Does Not Work

Learn why TypeScript interfaces do not exist at runtime, why `instanceof` fails, and how to safely check object shapes instead.

typescriptjavascriptinterface

Runtime Type Checks in TypeScript: Classes, Interfaces, instanceof, and Type Guards

Learn how runtime type checks work in TypeScript using instanceof, type guards, and why interfaces cannot be checked directly.

typescripttypecheckingtypeguards

String vs string in TypeScript: Primitive vs Wrapper Object

Learn the difference between string and String in TypeScript, why assignment fails, and when to use the primitive type instead.

typescript

Strongly Typed Function Parameters in TypeScript

Learn how to type callback function parameters in TypeScript using function signatures instead of Function for safer code.

typescript

Subject vs BehaviorSubject in RxJS: What’s the Difference?

Learn the difference between Subject and BehaviorSubject in RxJS, including current value behavior, subscriptions, and real examples.

typescriptangularrxjsbehaviorsubject

Page 4 of 6 - 112 questions