Practical solutions

TypeScript Howtos How-To Guides

Solve the problem. Keep building. Collection of TypeScript how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Cast a JSON Object to a Class in TypeScriptThis tutorial demonstrates how to cast a JSON object to a class in TypeScript. How to Have Type for Class Constructor in TypeScriptThis tutorial demonstrates how to have types for class constructors in TypeScript. How to Declare Map or List Type in TypeScriptThis tutorial demonstrates how to declare map or list types in TypeScript How to Use Axios in TypeScriptThis tutorial demonstrates how to use Axios in TypeScript. How to Push an Object Into an Array With TypeScriptThis tutorial teaches how to push an object into an array with TypeScript. How to Convert String to Date in Angular2 TypeScriptThis tutorial illustrates the ways of converting String to Date in Angular2 TypeScript. This article provides code examples of converting a String into Date. TypeScript fetch() MethodThe fetch is a globally available native browser function that can be used to fetch resource over an HTTP connection. In TypeScript, we can use the fetch function to consume typed response data. How to Use the Infer Keyword in TypeScriptThis article explains and demonstrates the type inference and implementation of conditional types in TypeScript. This also discusses the importance of the infer keyword and how to use it. How to Transform TypeScript Code Into JavaScript CodeThe methods that can be used to convert a TypeScript file to a JavaScript file are discussed in this article. How to Iterate Over Array of Objects in TypeScriptThis article explains how we can iterate over an array of objects in TypeScript. Accessing array elements is an important aspect in programming and looping mechanisms can be used. The forEach, for...of, for...in and for loops are the most used looping techniques. How to Interface Array of Objects in TypeScriptThis tutorial demonstrates how to interface array of objects in TypeScript. How to Get Current Date and Time in TypeScriptThis tutorial demonstrates how to get the current date and time in TypeScript. How to Convert String Into Number in TypeScriptThis tutorial demonstrates how to convert a string into a number in TypeScript. How to Extend Type in TypeScriptThis tutorial demonstrates how to extend type in TypeScript works. How to Compare Strings in TypeScriptThis tutorial demonstrates how to compare strings in TypeScript. How to Extend an Interface With Nested Properties in TypeScriptThis tutorial will teach you the different methods you can leverage to add properties to your base structure without modifying it. How to Initialize a Map Containing Arrays in TypeScriptThis tutorial shows how to create a Map that contains arrays in TypeScript. How to Create Custom Valueof Similar to Keyof to Return Union of Property Value Types in TypeScriptThis tutorial will show the reader how to create a custom valueof that returns the union of all possible value types and how to restrict key-values using generics and indexed access types. How to Import Type Feature of TypeScriptThis tutorial teach the reader when to use the import type and the import feature of TypeScript. How to Use Optional Props With Default Values in ReactThis tutorial demonstrates how to use optional props with default values in React. How to Manage User Events in React With TypeScriptThis tutorial teaches how to use user events in React with TypeScript. How to Convert a Boolean to a String Value in TypeScriptThere are various ways to convert a primitive boolean value to a string value. The most recommended methodology is to use the global String() function. Apart from that, we can use the toString() method and the ternary operator. How to Check the Object Type on Runtime in TypeScriptThis article discusses how to check the object type on runtime in TypeScript. The Ternary Operator in TypeScriptThere are different types of operators available in TypeScript. These operators can be categorized into different groups based on the number of operators they operate. The TypeScript conditional operator is the ternary operator that takes three operands.