Tag: TypeScript

HomeTagsTypeScript

Become a member

Get related updates from Syskool.

Creating and Using Custom Type Declarations (.d.ts files)

Table of Contents Introduction What is a Declaration File? Benefits of Using Custom Type Declarations How to Create a .d.ts File Example: Creating a Custom Declaration for a Library Using...

Working with Third-Party JavaScript Libraries (DefinitelyTyped, @types)

Table of Contents Introduction The Need for Type Definitions in TypeScript Understanding DefinitelyTyped and @types Installing Type Definitions from DefinitelyTyped Working with Libraries Without Type Definitions Creating Custom Type Definitions Conclusion Introduction TypeScript...

Error Handling Patterns in Async Code

Table of Contents Introduction The Basics of Error Handling Using Try/Catch with Async Functions Handling Multiple Async Operations Returning Errors from Async Functions Handling Errors with Promise.all and Promise.race Graceful Error...

Async/Await with Type Safety

Table of Contents Introduction Understanding Async/Await Syntax Type Safety with Async Functions Typing Promise<T> Return Types Typing Parameters for Async Functions Handling Multiple Async Operations Error Handling in Async/Await Functions Using Type...

Promises in TypeScript: Typing Async Operations

Table of Contents Introduction What Are Promises in JavaScript and TypeScript? The Basics of Working with Promises Typing Promises in TypeScript Working with Promise<void> and Promise<never> Chaining Promises in TypeScript Handling...

Type Casting and Assertion Best Practices

Table of Contents Introduction What is Type Casting and Type Assertion? Difference Between Type Casting and Type Assertion Type Casting Best Practices Type Assertion Best Practices Common Pitfalls and How...

Discriminated Union Types and Exhaustive Type Checking

Table of Contents Introduction What Are Discriminated Union Types? Discriminated Unions with Literal Types Exhaustive Type Checking: What It Is and Why It’s Important Implementing Exhaustive Type Checking in...

Custom User-Defined Type Guards

Table of Contents Introduction What Are User-Defined Type Guards? Syntax of User-Defined Type Guards Why Use Custom Type Guards? Creating Custom Type Guards Example 1: Checking for Specific Properties in...

Built-in Type Guards: typeof, instanceof

Table of Contents Introduction What Are Type Guards in TypeScript? typeof Type Guard Definition and Syntax Use Cases and Examples instanceof Type Guard Definition and Syntax Use Cases and Examples Practical Examples Example 1:...

Utility Types Part 3: ReturnType, Parameters, ConstructorParameters, InstanceType

Table of Contents Introduction Overview of Utility Types in TypeScript ReturnType<T> Definition and Syntax Use Cases and Examples Parameters<T> Definition and Syntax Use Cases and Examples ConstructorParameters<T> Definition and Syntax Use Cases and Examples InstanceType<T> Definition and...

Utility Types Part 2: Pick, Omit, Record

Table of Contents Introduction Overview of Utility Types in TypeScript Pick<T, K> Definition and Syntax Use Cases and Examples Omit<T, K> Definition and Syntax Use Cases and Examples Record<K, T> Definition and Syntax Use Cases...

Utility Types Part 1: Partial, Required, Readonly

Table of Contents Introduction What Are Utility Types in TypeScript? Overview of Partial, Required, and Readonly Utility Types Partial<T> Definition and Syntax Use Cases and Examples Required<T> Definition and Syntax Use Cases and...

Categories