万本电子书0元读

万本电子书0元读

顶部广告

Mastering TypeScript 3电子书

售       价:¥

4人正在读 | 0人评论 9.8

作       者:Nathan Rozentals

出  版  社:Packt Publishing

出版时间:2019-02-28

字       数:92.4万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Master the TypeScript language and its latest features. Explore modern application frameworks and utilize industry best practices in TDD, OOP and UI Design. Key Features * Learn the key features of TypeScript 3 and explore advanced language features through in-depth discussions. * Use TypeScript with modern frameworks including Backbone, Angular, Aurelia, React, and Node. * Explore TDD practices, OOP techniques, and industry best practices to create high-quality, modular, and adaptable applications. 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. Starting with an introduction to the TypeScript language, before moving on to basic concepts, each section builds on previous knowledge in an incremental and easy-to-understand way. Advanced and powerful language features are all covered, including asynchronous programming techniques, decorators, and generics. This book explores many modern JavaScript and TypeScript frameworks side by side in order for the reader to learn their respective strengths and weaknesses. It will also thoroughly explore unit and integration testing for each framework. Best-of-breed applications utilize well-known design patterns in order to be scalable, maintainable, and testable. This book explores some of these object-oriented techniques and patterns, and shows real-world implementations. By the end of the book, you will have built a comprehensive, end-to-end web application to show how TypeScript language features, design patterns, and industry best practices can be brought together in a real-world scenario. What you will learn * Gain insights into core and advanced TypeScript language features * Integrate existing JavaScript libraries and third-party frameworks using declaration files * Target popular JavaScript frameworks, such as Angular, React, and more * Create test suites for your application with Jasmine and Selenium * Organize your application code using modules, AMD loaders, and SystemJS * Explore advanced object-oriented design principles * Compare the various MVC implementations in Aurelia, Angular, React, and more Who this book is for This guide to the TypeScript that starts with basic concepts, and then builds on this knowledge to introduce more advanced language features and frameworks. No prior knowledge of JavaScript is required, although some prior programming experience is assumed. If you are keen to learn TypeScript, this book will give you all of the necessary knowledge and skills to tackle any TypeScript project. If you are already an experienced JavaScript or TypeScript developer, then this book will take your skills to the next level. Learn how to use TypeScript with a multitude of modern frameworks, and choose the best framework for your project requirements. Investigate techniques for Test Driven Development, explore industry-standard design patterns, and learn how to put together a full production-ready TypeScript application.
目录展开

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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部