TypeScript Revealed

Author: Dan Maharry
Publisher: Apress
Pages: 83
ISBN: 978-1430257253
Audience: .NET developers
Rating: 3
Reviewer: Mike James

TypeScript is a relatively small modification to JavaScript rather than being a complete language, so can a book with only 75 pages cover it?

This is a very thin book and this is not a bad thing. TypeScript really is such a small change to JavaScript that it probably can be covered in so few pages. However, to cover it in so few pages requires a few assumptions - some that the author probably isn't aware of. The first assumption is that you know JavaScript and you know its reputation for not being a good language. Many of the supposedly bad parts of JavaScript are pointed out, but mostly only as problems that TypeScript solves by some change in syntax. It is also assumed that you already know that strong typing and traditional class-based hierarchical typing is the right way to do things - of course this isn't necessarily your point of view if you haven't been "brought up right", i.e. your main language being Java, C++ or C#. In other words, this book is so short because it assumes that you see the sense in adopting something like TypeScript and this isn't necessarily as obvious as the book and many programmers think.

Banner

If the book is talking to any specific group it is to .NET programmers looking to find C# features in TypeScript. 

What you have to keep in mind is that dynamic languages like Ruby, Python, JavaScript and Scala are often proposed as being better approaches to programming than, say, Java precisely because they are weakly-typed. As a result they are not hampered by the same restrictions, nor overburdened with  mechanisms to get around the restrictions as Java-like languages are, see Data Typing Is A Relic. For example, what need does a weakly typed language have for generics? The arguments are not as clear cut in favour of a Java-like or C#-like version of JavaScript which is what TypeScript can sometimes seem to be. 

 

 

Chapter 1 gives an overview of the situation as seem from a non-JavaScript programmer's view point. It quotes the standard attacks on JavaScript and suggests that you take a look at the JavaScript you might find in the Google home page say - as if minified JavaScript gives you any idea of the difficulties inherent in the language. You might as well suggest that looking at Java Byte code is a good way to judge Java.

The chapter goes on to put a JavaScript outsider's view of the language and how bad it is. But if you don't know the language you aren't well placed to know how bad it is. From this point TypeScript is introduced as a version of JavaScript made to be more like Java - which is accurate enough. The book then goes on to describe TypeScript's syntax in terms of how it fixes problems with JavaScript.

The chapter also introduces the addons for Visual Studio and other ways of using TypeScript via simple editors, Node.js and so on. Surprisingly little is made of the real advantage of TypeScript which is IntelliSense and completion with type inference. This is almost worth more than the syntax modification introduced by TypeScript. 

Chapter 2 is a more concerted effort at explaining TypeScript. As TypeScript is compiled into standard JavaScript a useful way to understand it is to see what each new construct produces. The book does this, but it never explains what the JavaScript alternative does. So, for example, in the section on classes it shows a class declaration and then shows the JavaScript equivalent - and just comments that the TypeScript version is shorter and neater and that the whole point is to get away from "that". It suggests that if you really want to understand it then see a book on JavaScript. 

Chapter 3 is a short round-out that explains how to actually get things done with TypeScript. This is mostly about how to use the compiler to get various jobs done. 

So at the end of the book what have you learned? 

... that TypeScript is a JavaScript like language with C# like facilities. If you are a .NET programmer then this is helpful but you need to keep in mind that much of the advantage of TypeScript comes from using it within Visual Studio, which is an aspect that is underplayed in this book. 

So if you are converting to TypeScript from a strongly-typed, class-based language then this book will tell you mostly what you you already know or could find out from the documentation fairly quickly. Even so, you might want a copy to gather it all into one easy to carry format. 

If you are a JavaScript programmer, I doubt that this book will sell the idea of TypeScript to you simply because it makes no effort to do so. 

 

Banner


PostgresSQL 14 Administration Cookbook

Author: Simon Riggs and Gianno Ciolli
Publisher: Packt Publishing
Pages: 608
ISBN: 978-1803248974
Print:1803248971
Kindle: B09R4VBHX3
Audience: PostgresSQL developers and administrators
Rating: 4.5
Reviewer: Kay Ewbank

While this book describes itself as a cookbook, the recipes in it work through the nec [ ... ]



Python All-in-One, 3rd Ed (For Dummies)

Authors: John Shovic and Alan Simpson
Publisher: For Dummies
Date: April 2024
Pages: 720
ISBN: 978-1394236152
Print: 1394236158
Kindle: B0CW1C834N
Audience: People wanting to learn Python
Rating: 2
Reviewer: Mike James
All-in-one refers to the fact that this is seven books put together - why?


More Reviews

Last Updated ( Thursday, 30 May 2013 )