TypeScript Essentials
eBook - ePub

TypeScript Essentials

  1. 182 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

TypeScript Essentials

About this book

Web applications work on a range of different devices, making them one of the most common ways in which users experience the web today. However, while the flexibility of web apps are great for users, for developers creating them with JavaScript, the process can be difficult, requiring more extensive and detailed coding work. TypeScript helps make the development of web apps easier, allowing you to quickly create scalable applications that will reach desktops, tablets, and mobiles. With TypeScript, your code becomes much more manageable and your work much more efficient. Its additional features, such as static typing, facilitate IDE support and further tooling.

This quick and insightful guide will provide you with an easy way into TypeScript. You will discover the features of the TypeScript language and gain hands-on experience in creating a web application with reusable components. You will explore the compiler and learn how to manipulate the resulting output to fit specific needs.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Year
2014
Edition
1
eBook ISBN
9781783985760

TypeScript Essentials


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

TypeScript Essentials

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

Credits

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

About the Author

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.

About the Reviewers

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.

www.PacktPub.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 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.
Support files, eBooks, discount offers, and more
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.

Why subscribe?

  • 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...

Table of contents

  1. TypeScript Essentials

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access TypeScript Essentials by Christopher Nance in PDF and/or ePUB format, as well as other popular books in Informatik & Open-Source-Programmierung. We have over one million books available in our catalogue for you to explore.