更新时间:2021-08-27 18:35:20
封面
Title Page
Copyright and Credits
Learning TypeScript 2.x Second Edition
Dedication
Packt Upsell
Why subscribe?
PacktPub.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
Introducing TypeScript
The TypeScript architecture
Design goals
TypeScript components
TypeScript language features
Types
Type inference and optional static type annotations
Variables basic types and operators
Variable scope (var let and const)
Arithmetic operators
Comparison operators
Logical operators
Bitwise operators
Assignment operators
Spread operator
Flow control statements
The single-selection structure (if)
The double-selection structure (if...else)
The inline ternary operator (?)
The multiple-selection structure (switch)
The expression is tested at the top of the loop (while)
The expression is tested at the bottom of the loop (do...while)
Iterate on each object's properties (for...in)
Iterate values in an iterable (for...of)
Counter-controlled repetition (for)
Functions
Classes
Interfaces
Namespaces
Putting everything together
Summary
Working with Types
The TypeScript type system's characteristics
The line between TypeScript and JavaScript
Type inference
Optional static type annotations
Structural type system
Core features of the TypeScript type system
Union types
Type aliases
Intersection types
Non-nullable types
The --strict mode
The typeof operator
Type guards
Custom type guards
Control flow analysis
Literal types
Discriminated unions
The never type
Enumerations
Object literals
Weak types
The keyof operator
Index signature
Local types
Type casting
Advanced features of the TypeScript type system
Generic types
Generic constraints
Mapped types
Lookup types
Mapped type modifiers
Conditional types
The infer keyword
Built-in conditional types
The polymorphic this type
Ambient declarations
Type declarations – .d.ts
Working with Functions
Working with functions in TypeScript
Function declarations and function expressions
Function types
Trailing commas in function arguments
Functions with optional parameters
Functions with default parameters
Functions with REST parameters
Function overloading