Learning Typescript: Enhance Your Web Development Skills Using Type-Safe JavaScript
內容描述
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
Who Should Read This Book
If you have an understanding of writing JavaScript code, can run basic commands in a terminal, and are interested in learning about TypeScript, this book is for you.
Maybe you’ve heard TypeScript can help you write a lot of JavaScript with fewer bugs (true!) or document your code well for other people to read (also true!). Maybe you’ve seen TypeScript show up in a lot of job postings, or in a new role you’re starting.
Whatever your reason, as long as you come in knowing the fundamentals of JavaScript—variables, functions, closures/scope, and classes—this book will take you from no TypeScript knowledge to mastering the fundamentals and most important features of the language.
By the end of this book, you will understand:
• The history and context for why TypeScript is useful on top of “vanilla” JavaScript
• How a type system models code
• How a type checker analyzes code
• How to use development-only type annotations to inform the type system
• How TypeScript works with IDEs (Integrated Development Environments) to provide code exploration and refactoring tools
And you will be able to:
• Articulate the benefits of TypeScript and general characteristics of its type system.
• Add type annotations where useful in your code.
• Represent moderately complex types using TypeScript’s built-in inferences and new syntax.
Navigating this Book
Learning TypeScript has two purposes:
• You can read through it once to understand TypeScript as a whole.
• Later, you can refer back to it as a practical introductory TypeScript language reference.
This book ramps up from concepts to practical use across three general sections:
• Part I, “Concepts”: How JavaScript came to be, what TypeScript adds to it, and the foundations of a type system as TypeScript creates it.
• Part II, “Features”: Fleshing out how the type system interacts with the major parts of JavaScript you’d work with when writing TypeScript code.
• Part III, “Usage”: Now that you understand the features that make up the TypeScript language, how to use them in real-world situations to improve your code reading and editing experience.
作者介紹
Josh Goldberg is a frontend developer from New York with a passion for open source, static analysis, and the web. He is a full-time open-source maintainer who contributes regularly to TypeScript and open-source projects in its ecosystem, such as typescript-eslint and TypeStat. His past work includes spearheading Codecademy's usage of TypeScript, helping create its Learn TypeScript course, and architecting rich client applications at Microsoft. His projects range from static analysis to meta-languages to re-creating retro games in the browser. Also cats.