Go to main content
Formats
Format
BibTeX
MARCXML
TextMARC
MARC
DublinCore
EndNote
NLM
RefWorks
RIS

Linked e-resources

Details

Intro
Cover Page
Title Page
Copyright Page
Dedication Page
About the Author
Technical Reviewers
Acknowledgements
Preface
Errata
Table of Contents
1. Introduction to TypeScript and its Benefits
Introduction
Structure
Introduction to TypeScript
A short history of TypeScript
Main components of TypeScript
TypeScript’s type system
Advantages of using TypeScript
Catching bugs
Readability
Refactoring
Future language features
Disadvantages of TypeScript
The ways in which TypeScript prevents bugs
Steps to begin using TypeScript
Type-driven development
Conclusion
References
2. Setting up a Development Environment
Introduction
Structure
Installing dependencies
Version numbers
Installing Node.js On Windows
Installing Node.js on Mac
Installing a code editor
Installing TypeScript globally
Creating a new TypeScript project
The tsconfig.json file
Installing TypeScript locally to a project
Configuring TypeScript with tsconfig.json
Default enabled configuration options
target
module
esModuleInterop
forceConsistentCasingInFileNames
strict
skipLibCheck
Commonly used configuration options
files
include
exclude
baseUrl
rootDir
paths
outDir
resolveJsonModule
Top-level configuration options
Updating the project configuration
Enabling TypeScript checking in JavaScript
Default behavior
Enabling type checking
Adding JSDoc annotations
Example project structure and use
Conclusion
References
3. Basic Type Annotations
Introduction
Structure
Primitive types
BigInt
Boolean
Number
Null
String
Symbol
Undefined
The any type
The unknown type
The never type
The as operator
Down-casting
Compound casting
Older type-casting syntax.

Union types
Literal types
Literal union types
Type aliases
Type assertion
Non-null assertion operator
Conclusion
References
4. Using the TypeScript Compiler
Introduction
Structure
Compiling our TypeScript files
Inspecting compiled files
CLI flags

version

listFilesOnly

showConfig

help
Using watch mode
watchFile
watchDirectory
fallbackPolling
synchronousWatchDirectory
excludeDirectories
excludeFiles
assumeChangesOnlyAffectDirectDependencies
Environment variables
Building projects
Build-specific flags
Integrating with other build tools
Integrating with webpack
TypeScript webpack configuration
Using third-party libraries
Generating .d.ts files
Generating d.ts files from .js files
Conclusion
References
5. Enums, Interfaces, and Namespaces
Introduction
Structure
Interfaces
Interface merging
Extending interfaces
Namespaces
Namespace merging
Enums
Numeric enums
Reverse mapping
Exhaustiveness and the never type
String enums
Heterogeneous enums
Computed and constant enums
Literal enums
Inlining enums
Using the keyof operator
Conclusion
References
6. Objects, Arrays, and Tuples in TypeScript
Introduction
Structure
Arrays
Array type inference
Read-only arrays
Tuples
Optional elements in tuples
Rest elements in tuples
Read-only tuples
Object types
Property modifiers
Index signatures
Intersections
Generic object types
Readonly utility type
Conclusion
References
7. Functions in TypeScript
Introduction
Structure
Parameter Type and Return Type Annotations
Type Inference for Functions
Arrow Functions
Type Inference for Arrow Functions
Optional Parameters
Rest Parameters
Rest Arguments
Destructured Parameters.

Void return type
Function Type Expressions
Call signatures
Function Type Interfaces
This Parameter
Function overloads
Overloading Arrow Functions
Generator functions
Generic functions
Generic Function Constraints
Conclusion
References
8. Classes in TypeScript
Introduction
Structure
Class Declarations
Class Expressions
Constructors
Constructor Overloading
Parameter Properties
Access Modifiers
Private Members in JavaScript
Getters and Setters
This Parameter
Index Signatures
Implementing an Interface
Static Class Members
Static Blocks
Inheritance
Abstract Classes
Abstract Properties
Abstract Methods
Generic Classes
Decorators
TypeScript Design Patterns
Conclusion
References
9. Control Flow Analysis
Introduction
Structure
Narrowing
Widening
Type Guards
Truthiness Type Guards
Narrowing with Typeof
Handling null Values
Narrowing with Instanceof
Narrowing with the in Operator
Narrowing with Type Predicates
Discriminated Unions
Assertion Functions
Using as const
Conclusion
References
10. Manipulating Types
Introduction
Structure
Generics
Generic Interfaces
Generic Types
Generic Classes
Generic Functions
Conditional Types
Indexed Access Types
Mapped Types
Adding and Removing Property Modifiers
Remapping Property Keys
Template Literal Types
Capitalize
Uncapitalize
Uppercase
Utility Types
Awaited
ConstructorParameters
Exclude
Extract
InstanceType
NonNullable
Omit
OmitThisParameter
Partial
Parameters
Pick
Readonly
Record
Required
ReturnType
ThisParameterType
ThisType
Conclusion
References
11. TypeScript Modules
Introduction
Structure
Modules in TypeScript.

Importing and exporting modules
Type-only imports and exports
Compiled modules
Module-related configuration options
Module
Module resolution
Base URL
Paths
Rootdirs
Type roots
Module suffixes
Resolve JSON module
Module resolution
Compiler directives
Reference path
Reference types
Reference lib
No default lib
AMD module
AMD dependency
Barrel files
Nested barrels
Augmenting modules
Conclusion
References
12. Creating Declaration Files
Introduction
Structure
Creating declaration files
Declaring global libraries
Enhancing Intellisense with JSDoc
Declaring global functions and variables
Augmenting built-ins
Declaring modular libraries
Declaring default exports
Declaring classes
Declaring CommonJS modules
Declaring UMD modules
Publishing declarations
Publishing with the library
Publishing to Definitely Typed
Testing types
Conclusion
References
13. Building a Conference App with Angular and TypeScript
Introduction
Structure
Getting started
Running build tasks
Unit tests
Linting
Serving the application
Creating the application shell
Creating a data model
Adding views
Home view
Adding routing
Building the add-conference view
Adding the conferences view
Changing the default locale
Adding a page not found component
Handling data
Unit testing
Continuing with the example application
Conclusion
References
Index.

Browse Subjects

Show more subjects...

Statistics

from
to
Export