0%

Master the TypeScript language and its latest features, explore modern web application frameworks, and build modular systems using industry standard architectural principles and design patterns.

Key Features

  • Explore TypeScript 4's key elements and advanced language features
  • Use TypeScript with modern frameworks such as Angular, Vue, React, RxJS and Node
  • Understand TDD, serverless techniques, micro frontends, and other industry-standard best practices to create high-quality and modular apps

Book Description

TypeScript is both a language and a set of tools to generate JavaScript. It was designed by Anders Hejlsberg at Microsoft to help developers write enterprise-scale JavaScript.

Using a fast-paced, but easy-to-follow set of code samples, this fourth edition will get you up and running with Typescript quickly, introduce core concepts, and then build on this knowledge to help you understand and then apply more advanced language features.

Mastering TypeScript, Fourth Edition also covers a variety of modern JavaScript and TypeScript frameworks and compares their respective strengths and weaknesses. As you advance through this TypeScript book, you'll explore Angular, React, Vue, RxJs, Express, NodeJS, and others. You'll get up to speed with unit and integration testing, data transformation, serverless technologies, and asynchronous programming. You'll also learn how to integrate with existing JavaScript libraries, control your compiler options, and use decorators and generics.

By the end of the book, you will have built a comprehensive set of web applications using Angular, React, and Vue, having integrated them into a single cohesive website, using micro front-end techniques. Mastering TypeScript, Fourth Edition is about learning the language, understanding when to apply its features, and then selecting the framework that is the perfect fit for your real-world project.

What you will learn

  • Gain insights into core and advanced TypeScript language features
  • Integrate with existing JavaScript libraries and third-party frameworks
  • Build full working applications using JavaScript frameworks, such as Angular, React, Vue, and more
  • Create test suites for your application with Jest and Selenium
  • Apply industry-standard design patterns to build modular code
  • Develop web server solutions using NodeJS and Express
  • Design and implement serverless API solutions
  • Explore micro front-end technologies and techniques

Who this book is for

This book serves as a guide for beginners, as well as providing practical insights and techniques for experienced JavaScript and TypeScript programmers. No prior knowledge of JavaScript is required.

If you are keen to learn TypeScript, this book will give you all the necessary knowledge and skills to tackle any TypeScript project. It will also give you an understanding of what application frameworks are out there, and which one to choose for your next project. If you are already an experienced JavaScript or TypeScript developer, then this book will take your skills to the next level.

Table of Contents

  1. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Get in touch
  2. Up and Running Quickly
    1. A simple TypeScript IDE
    2. Using npm
    3. Hello TypeScript
    4. Template strings and JavaScript versions
    5. TypeScript project configuration
    6. Watching files for changes
    7. TypeScript basics
    8. Strong typing
    9. Basic types
    10. Inferred typing
    11. Duck typing
    12. Function signatures and void
    13. VS Code IntelliSense
    14. VS Code debugging
    15. Introducing third-party libraries
    16. Declaration files
    17. Summary
  3. Exploring the Type System
    1. any, let, unions, and enums
    2. The any type
    3. Explicit casting
    4. The let keyword
    5. Const values
    6. Union types
    7. Type guards
    8. Type aliases
    9. Enums
    10. String enums
    11. Const enums
    12. More primitive types
    13. Undefined
    14. Null
    15. Conditional expressions
    16. Optional chaining
    17. Nullish coalescing
    18. Null or undefined operands
    19. Definite assignment
    20. Object
    21. Unknown
    22. Never
    23. Never and switch
    24. Object spread
    25. Spread precedence
    26. Spread with arrays
    27. Tuples
    28. Tuple destructuring
    29. Optional tuple elements
    30. Tuples and spread syntax
    31. Object destructuring
    32. Functions
    33. Optional parameters
    34. Default parameters
    35. Rest parameters
    36. Function callbacks
    37. Function signatures as parameters
    38. Function overrides
    39. Literals
    40. Summary
  4. Interfaces, Classes, Inheritance, and Modules
    1. Interfaces
    2. Optional properties
    3. Interfaces are compiled away
    4. Interface naming
    5. Weak types
    6. The in operator
    7. keyof
    8. Classes
    9. The this keyword
    10. Implementing interfaces
    11. Class constructors
    12. Class modifiers
    13. JavaScript private fields
    14. Constructor parameter properties
    15. Readonly
    16. Get and set
    17. Static functions
    18. Static properties
    19. Namespaces
    20. Inheritance
    21. Interface inheritance
    22. Class inheritance
    23. The super function
    24. Function overriding
    25. Protected
    26. Abstract classes
    27. Abstract class methods
    28. instanceof
    29. Interfaces extending classes
    30. Modules
    31. Exporting modules
    32. Importing modules
    33. Module renaming
    34. Multiple exports
    35. Module namespaces
    36. Default exports
    37. Summary
  5. Generics and Advanced Type Inference
    1. Generics
    2. Generic syntax
    3. Multiple generic types
    4. Constraining the type of T
    5. Using the type T
    6. Generic constraints
    7. Generic interfaces
    8. Creating new objects within generics
    9. Advanced type inference
    10. Mapped types
    11. Partial, Readonly, Record, and Pick
    12. Conditional types
    13. Conditional type chaining
    14. Distributed conditional types
    15. Conditional type inference
    16. Type inference from function signatures
    17. Type inference from arrays
    18. Standard conditional types
    19. Summary
  6. Asynchronous Language Features
    1. Callbacks
    2. Promises
    3. Promise syntax
    4. Promise errors
    5. Returning values from Promises
    6. Promise return types
    7. Async and await
    8. Await syntax
    9. Await errors
    10. Await values
    11. Callbacks versus Promises versus async
    12. Summary
  7. Decorators
    1. Decorator overview
    2. Decorator setup
    3. Decorator syntax
    4. Multiple decorators
    5. Types of decorators
    6. Decorator factories
    7. Exploring decorators
    8. Class decorators
    9. Property decorators
    10. Static property decorators
    11. Method decorators
    12. Using method decorators
    13. Parameter decorators
    14. Decorator metadata
    15. Using decorator metadata
    16. Summary
  8. Integration with JavaScript
    1. Declaration files
    2. Global variables
    3. JavaScript code in HTML
    4. Finding declaration files
    5. Writing declaration files
    6. The module keyword
    7. Declaration file typing
    8. Function overloading
    9. Nested namespaces
    10. Classes
    11. Static properties and functions
    12. Abstract classes
    13. Generics
    14. Conditional types
    15. Conditional type inference
    16. Declaration file summary
    17. Integration compiler options
    18. The allowJs and outDir options
    19. Compiling JavaScript
    20. The declaration option
    21. Summary
  9. Strict Compiler Options
    1. Nested configuration
    2. Strict Options
    3. strictNullChecks
    4. strictPropertyInitialization
    5. strictBindCallApply
    6. strictFunctionTypes
    7. no compiler options
    8. noImplicitAny
    9. noUnusedLocals and noUnusedParameters
    10. noImplicitReturns
    11. noFallthroughCasesInSwitch
    12. noImplicitThis
    13. Summary
  10. Using Observables to Transform Data
    1. Introduction to Observables
    2. pipe and map
    3. Combining operators
    4. Avoid swallowing values
    5. Time-based Observables
    6. Observable errors
    7. catchError
    8. Observables returning Observables
    9. mergeMap
    10. concatMap
    11. forkJoin
    12. Observable Subject
    13. Summary
  11. Test-Driven Development
    1. The testing paradigm
    2. Unit, integration, and acceptance tests
    3. Unit tests
    4. Integration tests
    5. Acceptance tests
    6. Unit testing frameworks
    7. Jest
    8. ts-jest
    9. Watch mode
    10. Grouping tests
    11. Forcing and skipping tests
    12. Matchers
    13. Test setup and teardown
    14. Data-driven tests
    15. Jest mocks
    16. Jest spies
    17. Spies returning values
    18. Asynchronous tests
    19. Using done
    20. Using async await
    21. HTML-based tests
    22. DOM events
    23. Protractor
    24. Selenium
    25. Finding page elements
    26. Summary
  12. Angular
    1. Angular setup
    2. Application structure
    3. Angular modules
    4. Angular Material
    5. A shared module
    6. An Angular application
    7. Angular DOM events
    8. Angular EventEmitter
    9. Angular services
    10. Angular Dependency Injection
    11. Child components
    12. Angular forms
    13. Reactive forms
    14. Reactive form templates
    15. Reading form values
    16. Angular unit testing
    17. Unit testing forms
    18. Reacting to domain events
    19. Summary
  13. React
    1. Introduction to React
    2. React setup
    3. JSX
    4. JSX and logic
    5. React props
    6. React event handling
    7. React state
    8. A React application
    9. Application overview
    10. Mechanical keyboard switches
    11. Application components
    12. The CollectionView component
    13. The ItemView component
    14. The DetailView component
    15. The App component
    16. React forms
    17. Summary
  14. Vue
    1. Introduction to Vue
    2. Vue setup
    3. Component structure
    4. Child components and props
    5. Component state
    6. Component events
    7. Computed props, conditionals, and loops
    8. A Vue application
    9. Application overview
    10. Material Design for Bootstrap
    11. App component
    12. ShoppingCart component
    13. ItemView component
    14. CheckoutView component
    15. ItemTotalView component
    16. Summary
  15. Node and Express
    1. Express introduction
    2. Express setup
    3. Express router
    4. Express configuration
    5. An Express application
    6. Express templating
    7. Handlebars configuration
    8. Using templates
    9. Static files
    10. Express forms
    11. Express session data and redirects
    12. Summary
  16. An AWS Serverless API
    1. Serverless setup
    2. AWS Lambda architecture
    3. Installing the SAM CLI
    4. Initializing a SAM application
    5. Generated structure
    6. Deploying a SAM application
    7. Building an API
    8. DynamoDB tables
    9. NoSQL Workbench
    10. Application API endpoints
    11. A Lambda function
    12. Compiling Lambdas
    13. Running Lambdas locally
    14. Lambda path parameters
    15. Processing database records
    16. API summary
    17. Summary
  17. Micro Front-ends
    1. Design concepts
    2. Micro front-end mechanisms
    3. The iframe technique
    4. The JavaScript technique
    5. The Registry technique
    6. What we will use
    7. Communication mechanisms
    8. Domain events
    9. The Event Bus
    10. Building a micro front-end application
    11. The global Event Bus
    12. Building a module
    13. Module typing
    14. React updates
    15. Loading data from an API
    16. React domain events
    17. Vue updates
    18. Vue domain events
    19. Fetching data in Vue
    20. Raising Events
    21. Angular micro front-end
    22. Micro front-end DOM Containers
    23. Rendering the React front-end
    24. Rendering the Vue front-end
    25. Angular domain events
    26. Our micro front-end application
    27. Thoughts on micro front-ends
    28. Summary
  18. Other Books You May Enjoy
  19. Index
3.17.128.129