Mastering TypeScript: Strategies and Best Practices

Table of Contents

Effective TypeScript

TypeScript and JavaScript

Options

Code Generation

Structural Typing

any

Type System

Editors

Sets of Values

Type Space vs. Value Space

Type Declarations

Avoid Object Wrapper Types

Excessive Property Checking

Function Expressions

Type vs. Interface

Operations and Generics

Index Signatures

Arrays, Tuples, and ArrayLike

readonly

Mapped Types

Type Inference

Variables

Type Widening

Type Narrowing

Create Objects All at Once

Aliases

async vs Callbacks

Context

Functional Constructs

Type Design

Valid States

Liberal in Accept, Strict in Produce

Documentation

Null Values to Perimeter

Unions of Interfaces

Precise Alternatives to Strings

Incomplete vs. Inaccurate

Generate Types from APIs

Problem Domain

Brands

Working with any

Narrowest Possible Scope

More Precise Variants

Hide Unsafe

Evolving any

Use unknown

Monkey Patching

Track Type Coverage

Types Declarations and @types

devDependencies

Three Versions

Exports

TSDoc

this in Callbacks

Conditional Types

Mirror Types

Testing Types

Writing and Running Code

Iteration

DOM

Private

Source Maps

Migration

Modern JavaScript

@ts-checking

allowJs

Module Conversion

noImplicitAny

Author: Jason Walsh

j@wal.sh

Last Updated: 2024-10-30 16:43:54