ENGLISH

Hands-on TypeScript for C# and .NET Core Developers

Book information

Publisher
Packt
Year
2018
ISBN
978-1-78913-028-7
Language
english
Format
PDF
Filesize
4 MB (4495951 bytes)
Pages
449\449
Time added
2018-11-18 22:41:39

Description

Cover......Page 1 Title Page......Page 2 Copyright and Credits......Page 3 Dedication......Page 4 Packt Upsell......Page 5 Contributors......Page 6 Table of Contents......Page 8 Preface......Page 15 Basics and installation......Page 22 Adding types to JavaScript......Page 23 Using JavaScript of the future now!......Page 24 Installing the Visual Studio 2017 TypeScript SDK......Page 25 Installation of Node.js-based TypeScript compiler......Page 26 Adding TypeScript to your web projects......Page 27 Your first TypeScript file......Page 28 Running and debugging TypeScript code......Page 32 TypeScript compiler options......Page 33 Specifying parameters for the TypeScript compiler......Page 34 TypeScript configuration file......Page 35 TypeScript type system......Page 39 Strings, numbers, and Booleans......Page 40 The null and undefined subtypes......Page 41 Basics of union types......Page 42 void......Page 43 never......Page 44 Enums......Page 45 Declarations......Page 48 Obligatoriness of declarations and noImplicitAny......Page 49 Variable scoping......Page 51 Expressions – type assertions, and string interpolation......Page 53 Summary......Page 54 Further reading......Page 55 Technical requirements......Page 56 Array declaration......Page 57 Tuples......Page 60 Interfaces basics......Page 61 Readonly properties......Page 63 Optional properties......Page 64 Excess property check......Page 65 Defining function properties in interfaces......Page 66 Indexable types......Page 67 Interface inheritance......Page 70 Operations on types......Page 71 Intersection types......Page 72 Union types and type guards......Page 74 Discriminated unions......Page 76 Array destructuring......Page 77 Array spreads......Page 78 Tuples destructuring......Page 79 Object destructuring......Page 80 Object spreads......Page 81 Functions......Page 83 Anonymous functions and function types......Page 84 Optional arguments and destructuring......Page 85 Function overloads......Page 86 Arrow functions......Page 88 Summary......Page 89 Further reading......Page 90 Technical requirements......Page 91 DOM types......Page 93 TypeScript predefined declarations......Page 94 DOM basic types......Page 95 HTML specific types......Page 96 Basic DOM operations......Page 98 DOM manipulation utilities......Page 99 Removing an item......Page 100 Adding a new item......Page 102 Declaration files and JavaScript libraries......Page 103 Where to find declaration files......Page 104 How to use TypeScript declaration files......Page 105 DOM operations with jQuery......Page 106 Questions......Page 109 Further reading......Page 110 Technical requirements......Page 111 Classes......Page 112 Constructors......Page 115 Members definition and modifiers......Page 116 Implicit property definition......Page 118 Accessors......Page 119 Static members and static parts of a class......Page 121 What is the type of a class object?......Page 122 Inheriting from a class and implementing interfaces......Page 123 Implementing interfaces ......Page 124 Inheriting from a class......Page 125 Abstract classes and methods......Page 127 Modular design with inheritance, interfaces, and abstract classes......Page 128 Advanced type-compatibility ......Page 137 Summary......Page 140 Further reading......Page 141 Chapter 5: Generics......Page 142 Generic functions and interfaces......Page 143 A generic function for aggregating array elements......Page 145 Generic classes......Page 148 Generic constraints......Page 151 Type constraints......Page 152 Creating instances of generic variables......Page 154 The keyof constraints......Page 157 Questions......Page 160 Technical requirements......Page 161 Namespaces......Page 162 DOM manipulation re-engineered with namespaces......Page 165 Pitfalls of namespaces and ES6 modules......Page 167 Exporting module symbols......Page 168 Importing module symbols......Page 170 Default export and import......Page 171 Using ES6 modules in browsers......Page 173 DOM manipulation re-engineered with modules......Page 174 Loading modules......Page 176 Compile-time and runtime module-resolution......Page 178 Non-relative path module-resolution......Page 180 Dynamic-loading module......Page 183 Writing declaration files......Page 188 Ambient modules......Page 191 Automatic generation of declaration files......Page 193 Summary......Page 194 Questions......Page 195 Further reading......Page 196 Chapter 7: Bundling with WebPack......Page 197 Bundling TypeScript and JavaScript......Page 198 WebPack loaders – bundling TypeScript files......Page 205 WebPack plugins – recovering the Visual Studio debugger ......Page 208 The WebPack module's resolution algorithm......Page 209 Integrating WebPack in ASP.NET Core middleware......Page 213 Watch mode and Hot Modules Replacement......Page 214 Library bundling – DllPlugin......Page 218 Automatic common chunk extraction – SplitChunksPlugin......Page 222 Dynamic loading......Page 226 Production and development configurations......Page 228 Bundling CSS, images, and HTML......Page 230 Bundling images......Page 231 Bundling HTML......Page 232 Bundling CSS......Page 233 Summary......Page 239 Questions......Page 240 Further reading......Page 241 Technical requirements......Page 242 Using VS Code......Page 243 Building your library......Page 247 Packaging your library as an npm package......Page 249 Installing a test framework – Jasmine......Page 251 Testing your library with Jasmine......Page 254 Writing domlist library tests......Page 255 Debugging tests......Page 258 Questions......Page 259 Further reading......Page 260 Technical requirements......Page 261 Symbols......Page 262 Symbol.toPrimitive......Page 266 Symbol.search, Symbol.match, and Symbol.replace......Page 267 Symbol.split......Page 268 Iterators and iterables......Page 269 Generator functions and iterables......Page 271 Inheriting from Array......Page 274 ECMAScript 2015 built-in iterables......Page 275 Map and WeakMap......Page 276 Set and WeakSet......Page 277 Promises and async/await notation......Page 278 fetch API......Page 283 async/await notation......Page 284 Decorators and metadata......Page 287 Class decorators......Page 289 Decorator factories......Page 291 JavaScript built-in metadata – PropertyDescriptor......Page 292 Method and accessor decorators......Page 293 Handling metadata with the reflect-metadata polyfill......Page 294 Parameter decorators......Page 296 Property decorators......Page 298 Summary......Page 299 Questions......Page 300 Further reading......Page 301 Chapter 10: Angular ASP.NET Core Project Template......Page 302 Technical requirements......Page 303 Creating an Angular project......Page 304 Project structure......Page 307 The main application folder......Page 309 Angular architecture......Page 313 How Angular updates the HTML rendered by component templates......Page 317 Modules, components, and data binding......Page 318 Template bindings......Page 322 Style and class bindings......Page 325 Events and two-way bindings......Page 326 Angular modules......Page 328 Configuring and building an Angular application......Page 330 Building and serving the application......Page 334 Summary......Page 336 Questions......Page 337 Technical requirements......Page 338 Angular lifetime events......Page 339 How to handle Angular life cycle hooks......Page 340 Using a Bootstrap modal in Angular......Page 341 Angular update events......Page 346 Component interaction......Page 347 Custom two-way bindings......Page 349 Forms......Page 351 Pipes......Page 357 Defining custom pipes......Page 360 Application localization......Page 361 Questions......Page 362 Further reading......Page 363 Technical requirements......Page 364 Attribute directives......Page 365 Defining max, min, and step validation attributes......Page 366 Content projection and structural directives......Page 368 The inputError directive......Page 372 Predefined structural directories......Page 375 Animations......Page 376 Triggers, states, and state transitions......Page 378 Parallel and child animations......Page 383 Questions......Page 386 Technical requirements......Page 387 Services and Dependency Injection......Page 388 Angular injectors' hierarchy......Page 390 Service providers......Page 393 Injecting localized error messages......Page 397 Client-server communication......Page 400 Sending data to the server......Page 405 Communication progress events......Page 408 Preventing XSRF attacks......Page 410 Interceptors......Page 413 Routing and navigation......Page 415 Required and optional parameters......Page 417 Improving routes......Page 419 Children routes and named router-outlets......Page 420 Guards......Page 422 Lazy loaded modules......Page 426 Testing......Page 429 Summary......Page 431 Further reading......Page 432 Assessments......Page 434 Other Books You May Enjoy......Page 442 Index......Page 445

Similar books