TypeScript is JavaScript with an important upgrade! By adding a strong type system to JavaScript, TypeScript can help you eliminate entire categories of runtime errors. In TypeScript Quickly, you’ll learn to build rock-solid apps through practical examples and hands-on projects under the expert instruction of experienced web developers Yakov Fain and Anton Moiseev.
About the technology
Strong typing can eliminate nearly all errors caused by unanticipated data values. With TypeScript, an enhanced version of JavaScript, you can specify types and type annotations so your code is easier to read and far less likely to fail at runtime. And because the core of TypeScript is standard JavaScript, it runs on all major browsers and can be used with frameworks like Angular, Vue, and React.
About the book
TypeScript Quickly teaches you to exploit the benefits of types in browser-based and standalone applications. In this practical guide, you’ll build a fascinating blockchain service app that takes you through a range of type-sensitive programming techniques. As you go, you’ll also pick up valuable techniques for object-oriented programming with classes, interfaces, and advanced features such as decorators and conditional types.
what's inside
• Mastering TypeScript syntax
• Using TypeScript with JavaScript libraries
• Tooling with Babel and Webpack
• Developing TypeScript apps using Angular, React, and Vue
About the reader
For web developers comfortable with JavaScript and HTML.
About the author
Yakov Fain and Anton Moiseev are experienced web developers. They have authored two editions of Manning’s Angular Development with TypeScript.
Author(s): Yakov Fain, Anton Moiseev
Edition: 1
Publisher: Manning Publications
Year: 2020
Language: English
Commentary: Vector PDF
Pages: 488
City: Shelter Island, NY
Tags: JavaScript; Blockchain; Web Applications; Node.js; Object-Oriented Programming; Decorators; Angular; TypeScript; Vue.js; Type-Driven Development; React.js
TypeScript Quickly
contents
preface
acknowledgments
about this book
Who should read this book
How this book is organized: A roadmap
About the code
liveBook discussion forum
About the authors
about the cover illustration
Part 1: Mastering the TypeScript syntax
Chapter 1: Getting familiar with TypeScript
1.1 Why program in TypeScript
1.2 Typical TypeScript workflows
1.3 Using the Typescript compiler
1.4 Getting familiar with Visual Studio Code
Chapter 2: Basic and custom types
2.1 Declaring variables with types
2.1.1 Basic type annotations
2.1.2 Types in function declarations
2.1.3 The union type
2.2 Defining custom types
2.2.1 Using the type keyword
2.2.2 Using classes as custom types
2.2.3 Using interfaces as custom types
2.2.4 Structural vs. nominal type systems
2.2.5 Unions of custom types
2.3 The any and unknown types, and user-defined type guards
2.4 A mini project
Chapter 3: Object-oriented programming with classes and interfaces
3.1 Working with classes
3.1.1 Getting familiar with class inheritance
3.1.2 Access modifiers public, private, protected
3.1.3 Static variables and a singleton example
3.1.4 The super() method and the super keyword
3.1.5 Abstract classes
3.1.6 Method overloading
3.2 Working with interfaces
3.2.1 Enforcing the contract
3.2.2 Extending interfaces
3.2.3 Programming to interfaces
Chapter 4: Using enums and generics
4.1 Using enums
4.1.1 Numeric enums
4.1.2 String enums
4.1.3 Using const enums
4.2 Using generics
4.2.1 Understanding generics
4.2.2 Creating your own generic types
4.2.3 Creating generic functions
4.2.4 Enforcing the return type of higher-order functions
Chapter 5: Decorators and advanced types
5.1 Decorators
5.1.1 Creating class decorators
5.1.2 Creating method decorators
5.2 Mapped types
5.2.1 The Readonly mapped type
5.2.2 Declaring your own mapped types
5.2.3 Other built-in mapped types
5.3 Conditional types
5.3.1 The infer keyword
Chapter 6: Tooling
6.1 Source maps
6.2 The TSLint linter
6.3 Bundling code with Webpack
6.3.1 Bundling JavaScript with Webpack
6.3.2 Bundling TypeScript with Webpack
6.4 Using the Babel compiler
6.4.1 Using Babel with JavaScript
6.4.2 Using Babel with TypeScript
6.4.3 Using Babel with TypeScript and Webpack
6.5 Tools to watch
6.5.1 Introducing Deno
6.5.2 Introducing ncc
Chapter 7: Using TypeScript and JavaScript in the same project
7.1 Type definition files
7.1.1 Getting familiar with type definition files
7.1.2 Type definition files and IDEs
7.1.3 Shims and type definitions
7.1.4 Creating your own type definition files
7.2 A sample TypeScript app that uses JavaScript libraries
7.3 Introducing TypeScript in your JavaScript project
Part 2: Applying TypeScript in a blockchain app
Chapter 8: Developing your own blockchain app
8.1 Blockchain 101
8.1.1 Cryptographic hash functions
8.1.2 What a block is made of
8.1.3 What’s block mining
8.1.4 A mini project with hash and nonce
8.2 Developing your first blockchain
8.2.1 The project’s structure
8.2.2 Creating a primitive blockchain
8.2.3 Creating a blockchain with proof of work
Chapter 9: Developing a browser-based blockchain node
9.1 Running the blockchain web app
9.1.1 The project structure
9.1.2 Deploying the app using npm scripts
9.1.3 Working with the blockchain web app
9.2 The web client
9.3 Mining blocks
9.4 Using crypto APIs for hash generation
9.5 The standalone blockchain client
9.6 Debugging TypeScript in the browser
Chapter 10: Client-server communications using Node.js, TypeScript, and WebSockets
10.1 Resolving conflicts using the longest chain rule
10.2 Adding a server to the blockchain
10.3 The project structure
10.4 The project’s configuration files
10.4.1 Configuring the TypeScript compilation
10.4.2 What’s in package.json
10.4.3 Configuring nodemon
10.4.4 Running the blockchain app
10.5 A brief introduction to WebSockets
10.5.1 Comparing HTTP and WebSocket protocols
10.5.2 Pushing data from a Node server to a plain client
10.6 Reviewing notification workflows
10.6.1 Reviewing the server’s code
10.6.2 Reviewing the client’s code
Chapter 11: Developing Angular apps with TypeScript
11.1 Generating and running a new app with Angular CLI
11.2 Reviewing the generated app
11.3 Angular services and dependency injection
11.4 An app with ProductService injection
11.5 Programming to abstractions in TypeScript
11.6 Getting started with HTTP requests
11.7 Getting started with forms
11.8 Router basics
Chapter 12: Developing the blockchain client in Angular
12.1 Launching the Angular blockchain app
12.2 Reviewing AppComponent
12.3 Reviewing TransactionFormComponent
12.4 Reviewing the BlockComponent
12.5 Reviewing services
Chapter 13: Developing React.js apps with TypeScript
13.1 Developing the simplest web page with React
13.2 Generating and running a new app with Create React App
13.3 Managing a component’s state
13.3.1 Adding state to a class-based component
13.3.2 Using hooks to manage state in functional components
13.4 Developing a weather app
13.4.1 Adding a state hook to the App component
13.4.2 Fetching data with the useEffect hook in the App component
13.4.3 Using props
13.4.4 How a child component can pass data to its parent
13.5 What’s Virtual DOM?
Chapter 14: Developing a blockchain client in React.js
14.1 Starting the client and the messaging server
14.2 What changed in the lib directory
14.3 The smart App component
14.3.1 Adding a transaction
14.3.2 Generating a new block
14.3.3 Explaining the useEffect() hooks
14.3.4 Memoization with the useCallback() hook
14.4 The TransactionForm presentation component
14.5 The PendingTransactionsPanel presentation component
14.6 The BlocksPanel and BlockComponent presentation components
Chapter 15: Developing Vue.js apps with TypeScript
15.1 Developing the simplest web page with Vue
15.2 Generating and running a new app with Vue CLI
15.3 Developing single-page apps with router support
15.3.1 Generating a new app with the Vue Router
15.3.2 Displaying a list of products in the Home view
15.3.3 Passing data with the Vue Router
Chapter 16: Developing the blockchain client in Vue.js
16.1 Starting the client and the messaging server
16.2 The App component
16.3 The TransactionForm presentation component
16.4 The PendingTransactionsPanel presentation component
16.5 The BlocksPanel and Block presentation components
Appendix: Modern JavaScript
A.1 How to run the code samples
A.2 The keywords let and const
A.2.1 The var keyword and hoisting
A.2.2 Block scoping with let and const
A.3 Template literals
A.3.1 Tagged template strings
A.4 Optional parameters and default values
A.5 Arrow function expressions
A.6 The rest operator
A.7 The spread operator
A.8 Destructuring
A.8.1 Destructuring objects
A.8.2 Destructuring arrays
A.9 Classes and inheritance
A.9.1 Constructors
A.9.2 The super keyword and the super function
A.9.3 Static class members
A.10 Asynchronous processing
A.10.1 A callback hell
A.10.2 Promises
A.10.3 Resolving several promises at once
A.10.4 async-await
A.11 Modules
A.11.1 Imports and exports
A.12 Transpilers
index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
Y