Questions

TypeScript questions

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

Angular formGroup Error Explained: Fixing 'Can't bind to formGroup' in Reactive Forms

Learn why Angular shows 'Can't bind to formGroup' and how to fix it by importing ReactiveFormsModule correctly.

typescriptangularangular2-forms

Fix "Element implicitly has an 'any' type" in TypeScript Object Indexing

Learn why TypeScript rejects string object indexing and how to fix it with keyof, unions, and typed object keys in React.

typescript

Fix "Property has no initializer" in Angular TypeScript Components

Learn why Angular TypeScript shows "Property has no initializer" and how to fix it using defaults, optional properties, or definite assignment.

typescriptangular

Fix 'Could not find a declaration file for module' in TypeScript

Learn why TypeScript cannot find declaration files for a package and how to fix it with types, package.json, and module resolution.

typescriptnode-modules

How to Add a Custom Property to window in TypeScript

Learn how to declare custom properties on the window object in TypeScript using global interface augmentation and safe examples.

typescript

How to Check for null and undefined in TypeScript

Learn how to check for both null and undefined in TypeScript using strict comparisons, == null, and type-safe patterns.

typescriptnull-check

How to Convert a String to a Number in TypeScript

Learn how to convert a string to a number in TypeScript using Number, unary plus, parseInt, and parseFloat with examples and pitfalls.

typescriptjavascript

How to Convert a String to an Enum in TypeScript

Learn how to convert a string to an enum in TypeScript, including enum lookup, validation, reverse mapping, and common pitfalls.

typescript

How to Create Class Constants in TypeScript

Learn how to represent class constants in TypeScript using readonly and static readonly properties with clear examples and common pitfalls.

typescriptclass-constants

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.

typescript

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.

typescript

How to Extend Types in TypeScript

Learn how to extend types in TypeScript using intersections and interfaces, with examples, mistakes, and real project patterns.

typescriptjavascript

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.

typescriptangular

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.

typescriptenums

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 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 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 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

Page 1 of 2 - 32 questions

PreviousNext