Effective TypeScript

83 Specific Ways to Improve Your Typescript

Paperback Engels 2024 2e druk 9781098155063
€ 69,24
Levertijd ± 16 werkdagen
Gratis verzonden

Samenvatting

TypeScript is a typed superset of JavaScript with the potential to solve many of the headaches for which JavaScript is famous. But TypeScript has a learning curve of its own, and understanding how to use it effectively takes time and practice. Using the format popularized by Effective C++ and Effective Java (both Addison-Wesley), this practical book features 83 items that give specific advice on what to do and what not to do, and how to think about the language.

Author Dan Vanderkam shows you how to apply each item's advice through concrete examples. This book will help you advance from a beginning or intermediate user familiar with TypeScript basics to an expert who knows how to use the language well.

Updated for TypeScript 5, this second edition includes two new chapters on type-level programming and TypeScript recipes.

- Learn the nuts and bolts of TypeScript's type system
- Use type inference to get full safety with a minimum of type annotations
- Design types to make your code safer and more understandable
- Model complex APIs using generic types and type-level programming
- Understand how dependencies and type declaration files work in TypeScript
- Successfully migrate your JavaScript code base to TypeScript

Specificaties

ISBN13:9781098155063
Trefwoorden:TypeScript
Taal:Engels
Bindwijze:paperback
Aantal pagina's:399
Uitgever:O'Reilly
Druk:2
Verschijningsdatum:6-5-2024
Hoofdrubriek:IT-management / ICT

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Inhoudsopgave

Preface to the Second Edition
Who This Book Is For
Why I Wrote This Book
How This Book Is Organized
Conventions in TypeScript Code Samples
Typographical Conventions Used in This Book
Using Code Examples
O’Reilly Online Learning
How to Contact Us
Acknowledgments
Preface to the First Edition (2019)
Acknowledgments to the First Edition

1. Getting to Know TypeScript
Item 1: Understand the Relationship Between TypeScript and JavaScript
Item 2: Know Which TypeScript Options You’re Using
Item 3: Understand That Code Generation Is Independent of Types
Item 4: Get Comfortable with Structural Typing
Item 5: Limit Use of the any Type

2. TypeScript’s Type System
Item 6: Use Your Editor to Interrogate and Explore the Type System
Item 7: Think of Types as Sets of Values
Item 8: Know How to Tell Whether a Symbol Is in the Type Space or Value Space
Item 9: Prefer Type Annotations to Type Assertions
Item 10: Avoid Object Wrapper Types (String, Number, Boolean, Symbol, BigInt)
Item 11: Distinguish Excess Property Checking from Type Checking
Item 12: Apply Types to Entire Function Expressions When Possible
Item 13: Know the Differences Between type and interface
Item 14: Use readonly to Avoid Errors Associated with Mutation
Item 15: Use Type Operations and Generic Types to Avoid Repeating Yourself
Item 16: Prefer More Precise Alternatives to Index Signatures
Item 17: Avoid Numeric Index Signatures

3. Type Inference and Control Flow Analysis
Item 18: Avoid Cluttering Your Code with Inferable Types
Item 19: Use Different Variables for Different Types
Item 20: Understand How a Variable Gets Its Type
Item 21: Create Objects All at Once
Item 22: Understand Type Narrowing
Item 23: Be Consistent in Your Use of Aliases
Item 24: Understand How Context Is Used in Type Inference
Item 25: Understand Evolving Types
Item 26: Use Functional Constructs and Libraries to Help Types Flow
Item 27: Use async Functions Instead of Callbacks to Improve Type Flow
Item 28: Use Classes and Currying to Create New Inference Sites

4. Type Design
Item 29: Prefer Types That Always Represent Valid States
Item 30: Be Liberal in What You Accept and Strict in What You Produce
Item 31: Don’t Repeat Type Information in Documentation
Item 32: Avoid Including null or undefined in Type Aliases
Item 33: Push Null Values to the Perimeter of Your Types
Item 34: Prefer Unions of Interfaces to Interfaces with Unions
Item 35: Prefer More Precise Alternatives to String Types
Item 36: Use a Distinct Type for Special Values
Item 37: Limit the Use of Optional Properties
Item 38: Avoid Repeated Parameters of the Same Type
Item 39: Prefer Unifying Types to Modeling Differences
Item 40: Prefer Imprecise Types to Inaccurate Types
Item 41: Name Types Using the Language of Your Problem Domain
Item 42: Avoid Types Based on Anecdotal Data
Afgekapt op 62 regels

Managementboek Top 100

€ 69,24
Levertijd ongeveer 16 werkdagen
Gratis verzonden

Rubrieken

Producten

    Auteurs

      Trefwoorden

        Artikelen

          Effective TypeScript