0%

TypeScript has conquered the world of JavaScript: it's one of the world's fastest growing and most popular languages across developer surveys, widely used in consumer and business companies alike, and frequently credited for helping massive web applications scale. But what is TypeScript? How does it work, why does it work, and how can we use it?

Learning TypeScript takes beginner to intermediate JavaScript programmers from knowing nothing about "types" or a "type system" to full mastery of the fundamentals of TypeScript. It's more than a means to find bugs and typos--it's a useful system for declaring the way our JavaScript should work and helping us stick to it. You'll learn how TypeScript:

  • interacts with JavaScript
  • analyzes and understands code
  • augments your existing development pattern
  • helps you document your code
  • works with IDEs to provide refactoring tools
  • assists local development in refactoring code
  • helps you develop more quickly with fewer bugs

Table of Contents

  1. Preface
    1. Who Should Read This Book
    2. Why I Wrote This Book
    3. Navigating This Book
    4. Conventions Used in This Book
    5. Using Code Examples
    6. O’Reilly Online Learning
    7. How to Contact Us
    8. Acknowledgments
  2. 1. From JavaScript to TypeScript
    1. History of JavaScript
    2. Vanilla JavaScript’s Pitfalls
    3. Costly Freedom
    4. Loose Documentation
    5. Weaker Developer Tooling
    6. TypeScript!
    7. TypeScript in Action
    8. Freedom Through Restriction
    9. Precise Documentation
    10. Stronger Developer Tooling
    11. What TypeScript Is Not
    12. Getting Started in the TypeScript Playground
    13. Compiling Syntax
    14. Getting Started Locally
    15. Running Locally
    16. Editor Features
    17. Summary
  3. 2. The Type System
    1. What’s in a Type?
    2. Type Inferences in Detail
    3. Kinds of Errors
    4. Assignability
    5. Type Annotations
    6. Unnecessary Type Annotations
    7. Type Shapes
    8. Summary
  4. 3. Unions and Narrowing
    1. Union Types
    2. Declaring Union Types
    3. Union Properties
    4. Narrowing
    5. Assignment Narrowing
    6. Conditional Checks
    7. Summary
  5. 4. Literals
    1. Literal Types
    2. Literal Assignability
    3. Strict Null Checking
    4. The Billion Dollar Mistake
    5. Truthiness Narrowing
    6. Implicit Union Type Truthiness
    7. Summary
13.58.150.59