Programming TypeScript : making your JavaScript applications scale /
Any programmer working with a dynamically typed language will tell you how hard it is to scale to more lines of code and more engineers. That's why Facebook, Google, and Microsoft invented gradual static type layers for their dynamically typed JavaScript and Python code. This practical book sho...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Sebastopol, CA :
O'Reilly Media, Inc.,
2019.
|
Edición: | First edition. |
Temas: | |
Acceso en línea: | Texto completo (Requiere registro previo con correo institucional) |
Tabla de Contenidos:
- Intro; Preface; How This Book Is Organized; Style; Conventions Used in This Book; Using Code Examples; O'Reilly Online Learning; How to Contact Us; Acknowledgments; 1. Introduction; 2. TypeScript: A 10_000 Foot View; The Compiler; The Type System; TypeScript Versus JavaScript; How are types bound?; Are types automatically converted?; When are types checked?; When are errors surfaced?; Code Editor Setup; tsconfig.json; tslint.json; index.ts; Exercises; 3. All About Types; Talking About Types; The ABCs of Types; any; unknown; boolean; number; bigint; string; symbol; Objects
- Intermission: Type Aliases, Unions, and IntersectionsType aliases; Union and intersection types; Arrays; Tuples; Read-only arrays and tuples; null, undefined, void, and never; Enums; Summary; Exercises; 4. Functions; Declaring and Invoking Functions; Optional and Default Parameters; Rest Parameters; call, apply, and bind; Typing this; Generator Functions; Iterators; Call Signatures; Contextual Typing; Overloaded Function Types; Polymorphism; When Are Generics Bound?; Where Can You Declare Generics?; Generic Type Inference; Generic Type Aliases; Bounded Polymorphism
- Bounded polymorphism with multiple constraintsUsing bounded polymorphism to model arity; Generic Type Defaults; Type-Driven Development; Summary; Exercises; 5. Classes and Interfaces; Classes and Inheritance; super; Using this as a Return Type; Interfaces; Declaration Merging; Implementations; Implementing Interfaces Versus Extending Abstract Classes; Classes Are Structurally Typed; Classes Declare Both Values and Types; Polymorphism; Mixins; Decorators; Simulating final Classes; Design Patterns; Factory Pattern; Builder Pattern; Summary; Exercises; 6. Advanced Types
- Relationships Between TypesSubtypes and Supertypes; Variance; Shape and array variance; Function variance; Assignability; Type Widening; The const type; Excess property checking; Refinement; Discriminated union types; Totality; Advanced Object Types; Type Operators for Object Types; The keying-in operator; The keyof operator; The Record Type; Mapped Types; Built-in mapped types; Companion Object Pattern; Advanced Function Types; Improving Type Inference for Tuples; User-Defined Type Guards; Conditional Types; Distributive Conditionals; The infer Keyword; Built-in Conditional Types
- Escape HatchesType Assertions; Nonnull Assertions; Definite Assignment Assertions; Simulating Nominal Types; Safely Extending the Prototype; Summary; Exercises; 7. Handling Errors; Returning null; Throwing Exceptions; Returning Exceptions; The Option Type; Summary; Exercises; 8. Asynchronous Programming, Concurrency, and Parallelism; JavaScript's Event Loop; Working with Callbacks; Regaining Sanity with Promises; async and await; Async Streams; Event Emitters; Typesafe Multithreading; In the Browser: With Web Workers; Typesafe protocols; In NodeJS: With Child Processes; Summary; Exercises