TypeScript adds a lot of useful utility types that help the developer do common type transformations.
Whether it's to make properties from a type optional, to create a new tuple, or to pick some properties from a type TypeScript [...]
TypeScript adds a few new data types that the developer can use. One of them is the Tuple type.
A Tuple is a type of Array that knows how many elements it contains and at which position is which [...]
In TypeScript, just like in most programming languages, the switch statement is part of the control flow statements that a developer can use.
The switch statement executes different code blocks based on a specific condition.
In this article, you [...]
The keyof operator is one of the two type operators (the other one is the typeof operator) offered by TypeScript to facilitate type management.
The keyof operator is used to extract keys from a specific type into a union [...]
The Partial<Type> type is a built-in TypeScript utility type that takes a Type and creates a new type with all Type's properties set to optional.
(I know it's a lot of types).
It is often used, when you [...]
The TypeScript Record<Keys, Type> utility type is used to construct a new type whose properties are Keys and values are Type.
The Record type helps you create a new TypeScript type from a union type.
In this article [...]
TypeScript provides a lot of utility types that are going to help you do common type transformations. One of those types is the TypeScript Pick type.
The Pick type is used when you want to construct a type by [...]
In web development, you often need a data structure to hold a mapping of key/value pairs. This data structure has many names: a map, a dictionary, an associative array... Its functionality, however, always remains the same. The data structure [...]
The for loop is one of the most common operations in programming.
The for loop is used to execute a specific code block a specified number of times. Generally, one of the most common use-cases of this loop is [...]
Summary
TypeScript just like JavaScript has a special typeof operator.
In TypeScript, the typeof operator is used to refer to the type of a variable in a type context.
const v = 'This is a string';
const data: typeof [...]