Pro TypeScript [electronic resource] : Application-Scale JavaScript Development /
Fenton, Steve.author.
JavaScript is everywhere, both as a pure language and in popular libraries like Angular, jQuery and Knockout, but users of modern object-oriented languages like Java and C# often find JavaScript frustrating to use and hard to extend to large-scale applications. TypeScript is an innovative open source language from Microsoft that combines powerful language features and enhanced tooling support with the key attractions of JavaScript as a flexible, dynamic language that can run in any browser and on any operating system. Pro TypeScript tells you everything you need to know about this exciting new language and how to use it in your applications. Starting with an introduction to the language and its features, the book takes you through some of the major features of TypeScript in depth, from working with the type system through object-orientation to understanding the runtime and the TypeScript compiler. The book then covers some of the factors you need to consider when running a TypeScript application in the browser, including interacting with the DOM, making asynchronous requests, and working with useful browser APIs, followed by a demonstration of server-side TypeScript using the popular Node.js framework. Because TypeScript compiles to plain JavaScript, exception handling, memory management and garbage collection can differ depending on where you run your program, so these topics get a chapter to themselves. You'll also find out how to include popular JavaScript frameworks in your applications, so you can combine the benefits of TypeScript with some of the best JavaScript code that's already out there waiting to be used. The final chapter gives an overview of automated testing for TypeScript applications. Pro TypeScript offers a balanced and practical guide to a language that will transform your experience of JavaScript development.
Contents at a Glance; Contents; About the Author; Acknowledgments; Introduction; Chapter 1: TypeScript Language Features; JavaScript Is Valid TypeScript; Variables; Types; Type Annotations; Primitive Types; Arrays; Enumerations; Bit Flags; Type Assertions; Operators; Increment and Decrement; Binary Operators; Bitwise Operators; Logical Operators; NOT Operator; AND Operator; OR Operator; Short-Circuit Evaluation; Conditional Operator; Type Operators; Functions; Optional Parameters; Default Parameters; Rest Parameters; Overloads; Specialized Overload Signatures; Arrow Functions; Interfaces
ClassesConstructors; Access Modifiers; Properties and Methods; Class Heritage; Scope; Property and Arrow Function; Function Wrapping at Point of Call; ECMAScript 5 Bind Function; Choosing a Solution; Type Information; Modules; Internal Modules; External Modules; Module Loading; Export Assignments; Module Merging; Generics; Generic Functions; Generic Interfaces; Generic Classes; Type Constraints; TypeScript Futures; Summary; Chapter 2: The Type System; Type Systems; Optional Static Types; Structural Typing; Type Erasure; Type Inference; Best Common Type; Contextual Types; Widened Types
When to AnnotateDuplicate Identifiers; Type Checking; Ambient Declarations; Declaration Files; Definitely Typed; Summary; Key Points; Chapter 3: Object Orientation in TypeScript; Object Orientation in TypeScript; Open Recursion; Encapsulation; Delegation; Polymorphism; SOLID Principles; The Single Responsibility Principle (SRP); The Open-Closed Principle (OCP); The Liskov Substitution Principle (LSP); The Interface Segregation Principle (ISP); The Dependency Inversion Principle (DIP); Design Patterns; The Strategy Pattern; The Abstract Factory Pattern; Practical Example; Mixins
TypeScript MixinsWhen to Use Mixins; Restrictions; Summary; Key Points; Chapter 4: Understanding the Runtime; Runtime Features; Scope; Variable Hoisting; Callbacks; Passing Functions as Arguments; Events; TypeScript's Custom-Event Mechanism; Event Phases; Extending Objects; Extending the Prototype; Sealing Objects; Alternatives to Extending; Summary; Key Points; Chapter 5: Running TypeScript in a Browser; The Anatomy of a Web Browser; Reflows; The Interesting Components; The JavaScript Interpreter; A Brief History of Networking; Storing Data on the Client; The Document Object Model
Finding ElementsChanging Elements; Events; Frameworks and Libraries; Network; AJAX; HTTP Get; HTTP Post; WebSockets; Real-Time Communications; Storage; Session Storage; Local Storage; Storage Restrictions; IndexedDB; Upgrade Required; Querying the Database; Adding a New Record; Deleting a Record; IDBRequest Interface; Storage Roundup; Geolocation; Sensors; Battery Status; Proximity Sensor; Light Sensor; Motion and Orientation; Temperature, Noise, and Humidity; Sensor Roundup; Web Workers; Packaging Your Program; Summary; Key Points; Chapter 6: Running TypeScript on a Server; Install Node
Creating a New Project
Includes index.
JavaScript is everywhere, both as a pure language and in popular libraries like Angular, jQuery and Knockout, but users of modern object-oriented languages like Java and C# often find JavaScript frustrating to use and hard to extend to large-scale applications. TypeScript is an innovative open source language from Microsoft that combines powerful language features and enhanced tooling support with the key attractions of JavaScript as a flexible, dynamic language that can run in any browser and on any operating system. Pro TypeScript tells you everything you need to know about this exciting new language and how to use it in your applications. Starting with an introduction to the language and its features, the book takes you through some of the major features of TypeScript in depth, from working with the type system through object-orientation to understanding the runtime and the TypeScript compiler. The book then covers some of the factors you need to consider when running a TypeScript application in the browser, including interacting with the DOM, making asynchronous requests, and working with useful browser APIs, followed by a demonstration of server-side TypeScript using the popular Node.js framework. Because TypeScript compiles to plain JavaScript, exception handling, memory management and garbage collection can differ depending on where you run your program, so these topics get a chapter to themselves. You'll also find out how to include popular JavaScript frameworks in your applications, so you can combine the benefits of TypeScript with some of the best JavaScript code that's already out there waiting to be used. The final chapter gives an overview of automated testing for TypeScript applications. Pro TypeScript offers a balanced and practical guide to a language that will transform your experience of JavaScript development.
Microsoft software.
Microsoft .NET Framework.
Software engineering.
Programming languages (Electronic computers).
Microsoft and .NET.
Software Engineering/Programming and Operating Systems.
Programming Languages, Compilers, Interpreters.