Mastering TypeScript 3
Nathan Rozentals更新时间:2021-07-02 12:44:06
最新章节:Leave a review - let other readers know what you thinkcoverpage
Title Page
Copyright and Credits
Mastering TypeScript 3 Third Edition
About Packt
Why subscribe?
Packt.com
Contributors
About the author
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
TypeScript Tools and Framework Options
What is TypeScript?
JavaScript and the ECMAScript Standard
The benefits of TypeScript
Compiling
Strong typing
TypeScript's syntactic sugar
Type definitions for popular JavaScript libraries
DefinitelyTyped
Encapsulation
TypeScript classes generate closures
Public and private accessors
TypeScript IDEs
Node-based compilation
Creating a tsconfig.json file
Localized messages
Visual Studio Code
Installing VSCode
Exploring VSCode
Creating a tasks.json file
Building the project
Creating a launch.json file
Setting breakpoints
Debugging web pages
Microsoft Visual Studio
Creating a Visual Studio project
Default project settings
Debugging in Visual Studio
WebStorm
Creating a WebStorm project
Default files
Building a simple HTML application
Running the web page in Chrome
Other editors
Using --watch and Grunt
Summary
Types Variables and Function Techniques
Basic types
JavaScript typing
TypeScript typing
Type syntax
Inferred typing
Duck typing
Template strings
Arrays
for...in and for...of
The any type
Explicit casting
Enums
Const enums
String enums
Enum implementation
Const values
The let keyword
Definite assignment
Dotted property types
Numeric separators
Functions
Function return types
Anonymous functions
Optional parameters
Default parameters
Rest parameters
Function callbacks
Function signatures
Function overrides
Try catch
Advanced types
Union types
Type guards
Type aliases
Null and undefined
Null operands
Never
Unknown
Object rest and spread
Spread precedence
Rest and spread with arrays
Tuples
Tuple destructuring
Optional tuple elements
Tuples and rest syntax
Bigint
Summary
Interfaces Classes and Inheritance
Interfaces
Optional properties
Interface compilation
Weak types
Type inference with the in operator
Classes
Class properties
Implementing interfaces
Class constructors
Class functions
Interface function definitions
Class modifiers
Constructor access modifiers
Readonly properties
Class property accessors
Static functions
Static properties
Namespaces
Inheritance
Interface inheritance
Class inheritance
The super keyword
Function overriding
Protected class members
Abstract classes
JavaScript closures
instanceof
Using interfaces classes and inheritance – the Factory Design Pattern
Business requirements
What the Factory Design Pattern does
The IPerson interface
The Person class
Specialist classes
The Factory class
Using the Factory class
Summary
Decorators Generics and Asynchronous Features
Decorators
Decorator syntax
Multiple decorators
Decorator factories
Class decorator parameters
Property decorators
Static property decorators
Method decorators
Using method decorators
Parameter decorators
Decorator metadata
Using decorator metadata
Generics
Generic syntax
Instantiating generic classes
Using the type T
Constraining the type of T
Generic interfaces
Creating new objects within generics
Advanced types with generics
Conditional types
Distributed conditional types
Conditional type inference
keyof
keyof with number
Mapped types
Partial Readonly Record and Pick
Asynchronous language features
Promises
Promise syntax
Using promises
Callback versus promise syntax
Returning values from promises
async and await
await errors
Promise versus await syntax
await messages
Summary
Declaration Files and Strict Compiler Options
Global variables
Using JavaScript code blocks in HTML
Structured data
Writing your own declaration file
The module keyword
Interfaces
Union types
Module merging
Declaration syntax reference
Function overrides
The JavaScript syntax
The declaration file syntax
Nested namespaces
The JavaScript syntax
The declaration file syntax
Classes
The JavaScript syntax
The declaration file syntax
Class namespaces
The JavaScript syntax
The declaration file syntax
Class constructor overloads
The JavaScript syntax
The declaration file syntax
Class properties
The JavaScript syntax
The declaration file syntax
Class functions
The JavaScript syntax
The declaration file syntax
Static properties and functions
The JavaScript syntax
The declaration file syntax
Global functions
The JavaScript syntax
The declaration file syntax
Function signatures
The JavaScript syntax
The declaration file syntax
Optional properties
The JavaScript syntax
The declaration file syntax
Merging functions and modules
The JavaScript syntax
The declaration file syntax
Strict compiler options
noImplicitAny
strictNullChecks
strictPropertyInitialization
noUnusedLocals and noUnusedParameters
noImplicitReturns
noFallthroughCasesInSwitch
strictBindCallApply
Summary
Third-Party Libraries
Using definition files
Using NuGet
Using the NuGet Extension Manager
Installing declaration files
Using the Package Manager Console
Installing packages
Searching for package names
Installing a specific version
Using npm and @types
Using third-party libraries
Choosing a JavaScript framework
Backbone
Using inheritance with Backbone
Using interfaces
Using generic syntax
Using ECMAScript 5
Backbone TypeScript compatibility
Angular 1
Angular classes and $scope
Angular 1 TypeScript compatibility
Inheritance – Angular 1 versus Backbone
ExtJS
Creating classes in Ext JS
Using type casting
An Ext JS-specific TypeScript compiler
Summary
TypeScript Compatible Frameworks
What is MVC?
The Model
The View
The Controller
MVC summary
The Benefits of using MVC
Sample application outline
Using Backbone
Rendering performance
Backbone setup
Backbone structure
Backbone models
Backbone ItemView
Backbone ItemCollectionView
Backbone application
Backbone forms
Backbone summary
Using Aurelia
Aurelia setup
Aurelia controllers and models
Aurelia views
Aurelia application bootstrap
Aurelia events
Aurelia forms
Aurelia summary
Angular
Angular setup
Angular models
Angular views
Angular events
Angular forms
Angular template forms
Template form limitations
Angular Reactive forms
Using Reactive forms
Angular summary
Using React
React setup
Configuring webpack
React ItemView
React CollectionView
React bootstrapping
React forms
React state change
React state properties
React TypeScript features
JSX template rest syntax
Default properties
React summary
Performance comparison
Summary
Test-Driven Development
Test-driven development
Unit integration and acceptance tests
Unit tests
Integration tests
Acceptance tests
Unit testing frameworks
Jasmine
A simple Jasmine test
Test reporters
Matchers
Test start-up and tear-down
Forcing tests
Skipping tests
Data-driven tests
Using spies
Spying on callback functions
Using spies as fakes
Asynchronous tests
Using done()
Using async await
HTML-based tests
Jasmine fixtures
DOM events
Jasmine runners
Testem
Karma
Headless testing
Protractor
Using Selenium
Finding page elements
Using continuous integration
Benefits of CI
Selecting a build server
Team Foundation Server
Jenkins
TeamCity
Integration test reporting
Summary
Testing Typescript Compatible Frameworks
Testing our sample application
Backbone testing
Test setup
Model tests
Complex model tests
Rendering tests
DOM event tests
Collection view tests
Form tests
Backbone testing summary
Aurelia testing
Aurelia test setup
Aurelia unit tests
Rendering tests
Aurelia DOM events
Aurelia test summary
Angular testing
Angular test setup
Angular model tests
Angular rendering tests
Angular form tests
Angular testing summary
React testing
Multiple entry points
Using Jest
Basic React Test format
Initial state tests
React form input
React form submission
React testing summary
Summary
Modularization
Module basics
Exporting modules
Importing modules
Module renaming
Default exports
Exporting variables
Import types
AMD module loading
AMD compilation
AMD module setup
Require configuration
AMD browser configuration
AMD module dependencies
Bootstrapping Require
Fixing Require config errors
Incorrect dependencies
404 errors
SystemJS module loading
SystemJS installation
SystemJS browser configuration
SystemJS module dependencies
Bootstrapping Jasmine
Using Express with Node
Express setup
Using modules with Express
Express routing
Express templating
Using Handlebars
Express POST events
HTTP Request redirection
AWS Lambda functions
Lambda function architecture
AWS setup
Serverless
Serverless configuration
Serverless deployment
TypeScript Lambda functions
Lambda node modules
Lambda logging
Node REST testing
Summary
Object-Oriented Programming
Object-oriented principles
Programming to an interface
SOLID principles
Single responsibility
Open-closed
Liskov substitution
Interface segregation
Dependency inversion
User interface design
Conceptual design
Angular setup
Using Bootstrap and Font-Awesome
Creating a side panel
Creating an overlay
Coordinating transitions
The State pattern
State interface
Concrete states
The Mediator pattern
Modular code
Navbar component
SideNav component
RightScreen component
Child components
Mediator interface implementation
The Mediator class
Using the Mediator
Reacting to DOM events
Summary
Dependency Injection
Sending mail
Using nodemailer
Using a local SMTP server
A service class
Configuration settings
Object dependency
Service Location
Service Location anti-pattern
Dependency Injection
Building a dependency injector
Interface resolution
Enum resolution
Class resolution
Constructor injection
Decorator injection
Using a class definition
Parsing constructor parameters
Finding parameter types
Injecting properties
Using dependency injection
Recursive injection
Summary
Building Applications
Node and Angular integration
Angular Express server
Express server configuration
Server logging
The UI experience
Using Brackets
Using Emmet
Creating a login panel
Authentication
Angular routing
Using UI-designed HTML
Auth Guards
Login form binding
Using HttpClient
Using Observables
Using JWT tokens
Verifying JWT tokens
Using Observables in anger – of pipe and map
External authentication
Obtaining a Google API key
Configuring social login
Using Google user data
Summary
Let's Get Our Hands Dirty
Board Sales application
Database-driven APIs
Database structure
Express API endpoints
Parameterized API endpoints
Angular REST services
The OpenAPI specification
The BoardSales application
The BoardList component
Rendering REST data
Observables – concatMap
Observables – forkJoin
Unit-testing Observables
The Domain Events design pattern
Raising and consuming Domain Events
Observables – data filtering
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
更新时间:2021-07-02 12:44:06