Jump to ratings and reviews
Rate this book

Mastering TypeScript

Rate this book

Build enterprise-ready, industrial-strength web applications using TypeScript and leading JavaScript frameworks

About This Book Start with the basics, then enhance your knowledge with in-depth discussions on language features, third-party libraries, design patterns and more Practical examples that show how to use TypeScript with popular frameworks, including Backbone, Angular 2, React, Aurelia, Node and others Focus on test-driven development to build high quality applications that are modular, scalable and adaptable Who This Book Is For

Whether you are a JavaScript developer aiming to learn TypeScript, or an experienced TypeScript developer, this book will take your skills to the next level. From basic to advanced language constructs, test-driven development, object-oriented techniques and industry standard design patterns, you will learn how to get the most out of the TypeScript language.

What You Will Learn Gain an insight into core and advanced TypeScript language features Integrate your existing JavaScript libraries and third-party frameworks by writing and using declaration files Target popular JavaScript frameworks such as jQuery, Backbone, Angular, Aurelia, React, Node, and Express Create extensive test suites for your application with Jasmine, Protactor, and Selenium Organize your application code using modules, AMD loaders, Require and SystemJs Explore advanced object-oriented design principles, including Dependency Injection Understand and compare the various MVC implementations in Aurelia, Angular, React and Backbone Build a complete single-page web application that incorporates CSS animations to enhance your customers' browsing experience In Detail

The TypeScript language, compiler, and opensource development toolset brings JavaScript development up to the enterprise level. It allows us to use ES5, ES6, and ES7 JavaScript language features today, including classes, interfaces, generics, modules, and more. Its simple typing syntax enables building large, robust applications using object-oriented techniques and industry standard design principles.

Packed with practical, real-world examples, this book is a guide to bringing the benefits of strongly typed, object-oriented programming and design principles into the JavaScript development space. Starting with core language features, and working through more advanced topics such as generics and asynchronous programming techniques, you will learn how to gain maximum benefit from your JavaScript development with TypeScript. With a strong focus on test-driven development, and coverage of many popular and in-demand JavaScript frameworks, you can fast-track your TypeScript knowledge to a professional level. By the end of this book, you will be able to confidently build TypeScript applications, whether you are targeting Angular, Aurelia, React, Backbone, Node, or any other JavaScript framework.

Style and approach

With generous doses of small, easy to follow code samples, this hands-on guide builds up your TypeScript knowledge incrementally. Starting with entry-level concepts, and moving towards intermediate and then advanced techniques, this book provides practical examples of real-world techniques to build robust, testable, adaptable and enterprise-ready JavaScript applications.

552 pages, Kindle Edition

Published February 24, 2017

37 people are currently reading
59 people want to read

About the author

Nathan Rozentals

6 books1 follower

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
8 (14%)
4 stars
25 (43%)
3 stars
16 (28%)
2 stars
8 (14%)
1 star
0 (0%)
Displaying 1 - 8 of 8 reviews
Profile Image for Torben Koch.
27 reviews5 followers
March 30, 2020
This is a big book... 694 pages.

It does say "Mastering TypeScript 3" - I think it mostly fullfills this title, but there sure are a lot of bells and whistles :)

The book works through typescript, from the basics to the advanced stuff. As with most other books of this kind a lot of time is spent on the basic stuff and less time on the advanced stuff, which is a pity. It will teach you "all of TypeScript" but it will not make you master it.

The book then goes on (and on and on, it is long) about tool chains, testing frameworks and UI frameworks and how to use these with TypeScript. This is not a bad thing, though. Especially does it make sense to look at React, since TypeScript does have specific support for this, and Angular, since it is written in TypeScript.

Most of the examples in the book suffer from what all examples like these suffer: No context. This is probably the reason for the book to detour out into a longer description of various OO-principles, and how to crowbar these principles into TypeScript. Especially the section about DI (Dependency Injection) is an esoteric exercise. And it - by the way - clearly shows why DI is not the way to go ;)

It is a book that wants to do too much and therefore ends up doing a lot of it not particularly good, but it still is worth a read. The introduction to the language is fairly good and you can choose to skip the parts that does not interest you.

If the book had leveled up on the advanced TypeScript and used less pages on the not so TypeScript specific parts it could have gotten four stars. But for now - mostly due to the length - it gets three.
Profile Image for Inna Baikova.
11 reviews3 followers
May 16, 2018
The book is about old TypeScript specification and has examples on Backbone, but all the rest is impressive! There are not only TypeScript syntax and advantages, but also how to build and test TS application. I read a version of 2015 year, maybe a new one exists, when choose it
Profile Image for David.
134 reviews22 followers
June 30, 2015
One of the reasons many developers flock to JavaScript is because of the freedom that comes with writing code in a classless dynamic language, so why now the appeal to re-introduce coding "restrictions" into their day-to-day life with super-sets like TypeScript? Weren't we fine before without classes, lambdas, type-safety, interfaces, generics, enums, etc.? The short answer is of course, ES6 (the recently finalized 6th version of JavaScript) is bringing many new features and we'll all be adjusting to it eventually, and TypeScript blends well with many new ES6 features, yet offers many of its own ideas (which C# developers will instantly recognize) and the reader can evaluate for themselves the merit of each feature.

TypeScript offers many features that (unlike with C#) that compile away once your code is converted to native JavaScript (ie, you can't use reflection after the fact to infer types), so its main benefit is realized in introducing a compilation step to your current JavaScript coding process. This means you can enforce strong typing, use interfaces, generics, enums, explicitly declare public/private class members, which can potentially eliminate many problems that come with scaled-out enterprise level JavaScript applications. For those craving many of the object-oriented features they miss from C#, Java or similar languages, TypeScript ports over a familiar syntactic sugar to carve out JavaScript in a familiar way.

There were several times reading through this book where I started thinking that while TypeScript might not always be a better way to write JavaScript, it still feels like a better way to write C#. After I stopped working in C# for six months or so in favor of JavaScript, I suddenly had need to put together a simple C# application to assist the back-end developers at my company, and found myself trying to do things that were easy to do in JavaScript but extremely difficult to do in C#. Often you can't know for sure if you're going in the right direction without trying out a few things, and therefore the speed of JavaScript development is one of the best assets to rapid development, in my opinion. In C# this meant trying to try out an idea before sculpting out all the classes you need, and often I dipped into using the "dynamic" type, only to find it doesn't often play nicely with everything else in the whole C# ecosystem or behave the way you expect. After I had the basic ideas hammered out though, I was then able to go back through the application and clean it up by separating functionality into the appropriate classes and introduce the different types needed to stabilize the application. And it's that workflow that I'd point to as idea (again, in my opinion): prototype rapidly, and then stabilize the application with the clean refactoring necessary and "future proof" it with type safety.

This book covered a lot of material, including a full 60-page final chapter on building an SPA from scratch with TypeScript, but my only critique of it is it heavily favored Backbone throughout the book. Any quick peak at the popular front-end frameworks by search engine popularity (on google trends) will show Backbone tanking compared to the others out there (especially to Angular and React, and has recently even been overtaken by Ember), and with the Angular team's announcement of their adoption of TypeScript seems like it would have been the ideal candidate, but that's only my opinion and I'm sure many readers out there have reasons why they prefer other JS frameworks.

A tool like TypeScript (whether leveraged on the front-end JS or back-end in something like Node) allows that kind of workflow to be realized and helps preserve some of the great ideas present in languages like C# or Java. Time will tell how well TypeScript will catch on and how accepted it will become, especially as more developers beginning using ES6. My expectation is it will be most useful in larger applications.
Profile Image for Aleksandar Milincic.
49 reviews1 follower
January 8, 2022
I strongly reccomend this book to all software developers that aim to become experts in modern js frameworks, no matter their target is Angular or React.
The book itself is good to improve OOP (object oriented programming) concepts, general understanding of SOLID and other programming paradigms.
It's also good having a quick view into testing frameworks like Jasmin or Karma.
Recommend!
Profile Image for Damir Arh.
17 reviews2 followers
June 15, 2015
The book starts out pretty slow with the necessary introduction to the language and the tooling available for it. Complete beginners in TypeScript will probably appreciate this part the most, but it is really exhaustive, therefore even existing developers might learn something new. The same goes for type definitions; not only will the reader know how to use them, he will also learn to write his own, for JavaScript libraries that don't have them yet.

Still, in my opinion the real value is delivered in the later chapters of the book, where the focus shifts from the language specification to real-world scenarios. The author is reinforcing best practices all the time: explaining the SOLID principles, promoting testing and test driven development, implementing design patterns, such as factory, service locator, mediator and others. Seeing real software engineering approaches applied to TypeScript and JavaScript code is really valuable.

Unfortunately, JavaScript development today is strongly dependent on 3rd party libraries. This is a quickly evolving field with many alternatives available for every task. Because of this, the author couldn't completely avoid being subjective in his choice of frameworks, which he used in his samples. I like, how he compared them through the lens of a TypeScript developer, although you still shouldn't regard it as a guide to choosing the right one. It's just an incomplete overview that can get you started, when picking your own set of MV*, testing or modularization libraries.

I have mixed feelings about the custom frameworks developed throughout the book, implementing reflection, service locator and message bus functionalities. Although they have pedagogical value, they might be too tempting to use in own projects. In my opinion using these instead of maintained alternative open source libraries is not a good idea; and this isn't clearly communicated in the book.

In spite of that I have no reservations about recommending the book to any existing or future TypeScript developer. It can serve as the first book to start learning the language, but can teach you a lot even if you have already been programming in it for a while. Some of the samples towards the end of the book can become quite complex, but if you read the whole book and occasionally look at the code downloads, you should still be able to follow them.
7 reviews
June 18, 2015
I read this book as a newbie of the language. From the beginning, I like the style of the writing: clear and simple.
Having already a good background on javascript, after a few hours of reading I was able to setup a development environment and write simple applications.
The book is well structured. It begins from the basic concepts (in the first chapters the author introduces the avaiable IDEs and how to set up a development environment) and moving on the more complex ones (integration with popular javascript frameworks, test driven development and modularization).
The first 4 chapters are mainly oriented to the beginners but are also usefull for the experienced programmers (that can eventually skip them). They present elementary concepts like types, functions, classes, interfaces.
The following parts cover some more advanced topics: a whole chapter is dedicated to the integration with some of the most famous js frameworks (angularjs, backbone, extjs), highlighting the weaknesses and strengths. Another one is about on the unit tests and the modularization.
A very good thing is that the author focuses not only on the syntax of the language but also on the best practices (for example, he explains the SOLID principles and describes some popular design patterns and how they can be implemented in Typescript).
In conclusion, I enjoyed reading this book and I liked the way the author has presented the topics. I would recommend this book to anyone who wants to learn TypeScript.
Profile Image for Mahender Kumawat.
9 reviews4 followers
July 2, 2015
Too much of backbone dependency if you want to read it.
Should have been plain typescript only. There should be no external dependency on library/framework to learn/master typescript
Profile Image for Kris.
251 reviews14 followers
September 13, 2015
I just remembered why I don't like Java...
Displaying 1 - 8 of 8 reviews

Can't find what you're looking for?

Get help and learn more about the design.