![]()
Table of Contents
TypeScript Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with TypeScript
The advantages of TypeScript
Setting up the IDE
Hello World
Command-line compilation
Integrating Visual Studio
Creating a new project
Build options
Summary
2. TypeScript Basics
Types
Functions
Interfaces
Classes
Definitions
Interfaces
Static and instance members
Properties
Enums
Modules
Internal modules
Generic objects
Summary
3. The TypeScript Compiler
Generation of ECMAScript
ECMAScript version
Code manipulation
Controlling compiler output
JavaScript output
Source maps
Advanced options
Summary
4. Object-oriented Programming with TypeScript
The basics
SOLID â object-oriented design
Understanding inheritance
Encapsulation
Abstraction
Polymorphism
Method overloading
Operator overloading
Method overrides
References
Summary
5. Creating a Simple Drawing Application
Setting up the project
The shapes
Basic shapes
Drawing shapes
Making the application interactive
The engine
Mouse events
User options
Summary
6. Declaration Files and Library Integrations
Declaration files
Third-party library integration
Installing NuGet packages
Integrating with jQuery
Integrating with Knockout
Using RequireJS
Summary
7. Enhancing the Drawing Application
Converting to AMD modules
Binding the user controls
Reusable controls
Creating a ViewModel
Generating a single output file
Styling the application
Summary
8. Debugging TypeScript
Debugging
Source maps
Debuggers
Test-driven development
Unit testing
Adding tests
Summary
Index
![]()
Copyright Š 2014 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: October 2014
Production reference: 1161014
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-576-0
www.packtpub.com
![]()
Author
Christopher Nance
Reviewers
Andrea Martinelli
Nathan Rozentals
Basarat Ali Syed
Carlos Ballesteros Velasco
Commissioning Editor
Amarabha Banerjee
Acquisition Editor
Richard Gall
Content Development Editor
Arvind Koul
Technical Editor
Kunal Anil Gaikwad
Copy Editors
Maria Gould
Paul Hindle
Project Coordinator
Neha Bhatnagar
Proofreaders
Simran Bhogal
Ameesha Green
Paul Hindle
Indexers
Monica Ajmera Mehta
Priya Sane
Graphics
Disha Haria
Production Coordinators
Adonia Jones
Komal Ramchandani
Nitesh Thakur
Cover Work
Komal Ramchandani
![]()
Christopher Nance is an experienced software engineer and has been developing rich web applications for more than 4 years. At KnowledgeLake, he adopted TypeScript to develop a series of reusable components to scale across multiple product offerings and platforms.
![]()
Andrea Martinelli is a passionate software developer who is currently working on Shaman.IO, a tool that automatically detects and extracts structured data from the Web.
In the past, he worked on Songr, a music player and aggregator. His interests span across web data extraction, code performance, and statically typed languages. He is a proficient C# developer and has been interested in TypeScript since its initial announcement. He graduated from the University of Trento in Computer Science and then studied at the Technical University of Denmark, even though he is now dedicating more time to the Shaman.IO project while moving across Europe.
Nathan Rozentals has been writing commercial software for over 23 years, starting with COBOL on mainframes, through C, on to C++ and Java, and finally settling on C# and ASP.NET.
He picked up TypeScript in October 2012âa day after the 0.8.0 releaseâand could not put it down. In TypeScript, he found a language that could bring all of the design patterns and practices he had learned over the yearsâin a variety of languagesâto JavaScript.
Some 6 days after the 0.8.0 release, he began blogging about TypeScript; covering a variety of topics, including unit testing, implementing an IoC container, and organizing code with AMD modules. He knew he had hit the mark when Microsoft themselves started to reference his blog in their CodePlex discussion forums.
You can find his blog at http://blorkfish.wordpress.com.
He currently works in the health industry, bringing touchscreen interfaces to medical systems, thereby enabling BYOD for clinicians and hospital staff.
He is passionate about code quality, unit testing, and continuous integration, and has helped many large teams implement CI across many different software projects in many different languages.
When he is not coding, he loves windsurfing and playing soccer. He is also an avid Liverpool FC supporter.
Basarat Ali Syed (BAS) is a senior developer and the go-to guy for frontend issues at Picnic Software (http://picnicsoftware.com/) in Melbourne, Australia. He has a Master of Computing degree from Australian National University and graduated with high distinction in all courses. He is a familiar face at developer meetups and conferences in Australia and has been a speaker at events such as ALT.NET, DDD Melbourne, MelbJS, and Node.js meetups, among others. He is deeply passionate about web technologies. He is a known member of the TypeScript community and works on the DefinitelyTyped team (https://github.com/DefinitelyTyped). In his spare time, he enjoys bodybuilding, cycling, and maintains a YouTube channel for helping fellow developers (http://youtube.com/basaratali). You can easily find him on Twitter @basarat, www.github.com/basarat, and www.basarat.com.
![]()
Support files, eBooks, discount offers, and more
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.
http://PacktLib.PacktPub.com
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 w...