Found 33 articles tagged with #typescript

TypeScript Function Types

In TypeScript, there are different ways to write function types: function type expressions, call signatures, construct signatures, or generic functions.

May 17, 2023#typescript

TypeScript optional, nullable, and default parameters

These features enable you to write more flexible and robust code by allowing for the possibility of "undefined" or "null" values, and by providing default values when no value is passed in.

May 09, 2023#typescript#how-to

TypeScript Declaration Merging

Declaration merging allows multiple declarations of the same name to be merged into a single definition. This can be done for interfaces, namespaces, enums and other types.

Apr 06, 2023#typescript

5 ways to use `keyof` operator in TypeScript

By using `keyof`, you can define types that depend on the properties of an object without actually knowing the specific property names in advance.

Apr 06, 2023#typescript#how-to

TypeScript Conditional Types

Conditional types are a feature of the TypeScript language that allow for the creation of types that depend on the evaluation of other types.

Apr 05, 2023#typescript

Discriminated union types in TypeScript

A special kind of union types that can be narrowed down using a common property that each member of the union contains.

Apr 01, 2023#typescript

How to create mapped types in TypeScript

You can avoid repeating yourself by using mapped types to transform an existing type into a new type by mapping over its properties with some modifications.

Type Narrowing vs Type Casting in TypeScript

Type narrowing allows you to access properties and methods that are only available on certain types, and also helps TypeScript to catch errors and bugs at compile time.

JavaScript `this` binding in common contexts

In JavaScript, the "this" keyword is very flexible and confusing, evaluated at runtime, can have different values depending in which context it appears.

JavaScript Source Maps Demystified

This mapping allows developers to view and debug the original source code, even when the production code has been compressed and optimized for performance.