Copyright Š 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2016
Production reference: 1250716
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78588-701-7
www.packtpub.com
Ivo Gabe de Wolff has been a freelance developer under the name of ivogabe since 2012 and he is studying mathematics and computing sciences at Utrecht University. When he was eleven he started programming in Game Maker. Currently, he uses TypeScript on a daily basis. Recently, he has used TypeScript in lots of different environments, including mobile apps, servers, and command-line tools. Now he mainly specializes in NodeJS programming.
Furthermore, he is the author of various open source projects, including gulp-typescript. You can find his projects on github.com/ivogabe . If you want to read more about TypeScript, JavaScript, gulp, or Functional Programming, you can take a look at his blog at dev.ivogabe.com .
It required a lot of work to compose this book. I could not have done this without the help of these people:
The team at Packt Publishing and the reviewers of this book, because of their precise feedback and hard work. This has helped me a lot to improve the quality of this book.
My fellow students, for brainstorming and helping on specific topics.
My teachers at Utrecht University, for giving inspiration and challenging me on various topics. I especially want to thank Jurriaan Hage for supervising my thesis.
Finally, my family, for their support and tips, even though they did not have knowledge on these topics. These people have helped me to to make the book as it now lies in front of you.
Matthew Hill is a British software developer with substantial experience in web application development. An established developer in the TypeScript and JavaScript spheres, he thoroughly enjoys working on open source projects and dipping into often esoteric technologies. Outside of programming, Matthew has a fervent interest in literature.
After graduating with a computer science degree, he started his career at Sky UK Ltd, where he developed video streaming applications, subsequently moving on to engineer single-page analytics applications at payments startup Velocity. Now heâs working at financial services leader Tradeweb, fleshing out their next-generation JavaScript-based trading platform.
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at
www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
[email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
TypeScript allows developers to write readable and maintainable web applications. Editors can provide several tools to the developer, based on types and static analysis of the code. In this book, you will learn how you can use TypeScript to build clean web applications. You will learn how to use Angular 2 and React.
You will also learn how you can use TypeScript for servers, mobile apps, command-line tools, and games. We will build various servers, write a mobile app, rewrite Pac Man, and build Tic-Tac-Toe as a command-line application. You will also learn functional programming. This style of programming will improve your general code skills. You will see how this style can be used in TypeScript.
The book can be divided in two sections. The first section, chapters 1 to 4, describe how you can build standard application. These chapters introduce Angular 2 and React for web applications, NodeJS for servers and NativeScript for mobile apps. You should read chapters 1 to 3 in a sequence.
The second section, chapters 5 to 8, introduce more complex concepts. You will learn functional programming in chapters 5 to 7. The last chapter contains guidance to migrate a JavaScript codebase to TypeScript. You can read chapters 5 to 7 when you have not read chapters 1 to 4, though chapter 5 requires some knowledge of React.
Chapter 1, TypeScript 2.0 Fundamentals, will explain core principals to create (web) applications with TypeScript. If you have some basic knowledge of TypeScript 2.0 then you can skim over this chapter or use it as a reference while reading the other chapters. If you have not used TypeScript yet, then this chapter will teach you the fundamentals of TypeScript 2.0
Chapter 2, A Weather Forecast Widget with Angular 2, you will learn how you can build an application in Angular 2. The chapter introduces core principals of Angular and will use an online API as source for the weather forecast.
Chapter 3, Note-Taking App with a Server, we will build a server and client with Node and Angular for this application. You will see how code can be shared between the client and the server.
Chapter 4, Real-Time Chat, introduces React and websockets. Using these techniques, we will write the server and client of the chat application.
Chapter 5, Native QR Scanner App, after having written three web applications, we will now write a mobile app. You will learn how you can use NativeScript and its plugins to write a native app.
Chapter 6, Advanced Programming in TypeScript, covers more advanced features of TypeScript, including...