TypeScript In-depth

This course will help you learn all of the major language features in the latest versions of TypeScript.
Course info
Rating
(402)
Level
Intermediate
Updated
Mar 4, 2016
Duration
4h 40m
Table of contents
Course Overview
Introduction
Installation and Setup
TypeScript Basics
Functions
Interfaces
Classes
Modules and Namespaces
Generics
Compiler Options and Project Configuration
Type Definitions
Description
Course info
Rating
(402)
Level
Intermediate
Updated
Mar 4, 2016
Duration
4h 40m
Description

This course will begin with TypeScript basics such as the new syntax for variable declarations and progress through all of the major features of the language including arrow functions, interfaces, classes, modules, namespaces, and generics. Along the way, you'll learn not only the syntax, but also the benefits of the strong-typing support in TypeScript. TypeScript is an amazing language that compiles to JavaScript and is a perfect tool for building both client and server-side web applications.

About the author
About the author

Brice has been a professional developer for over 20 years and loves to experiment with new tools and technologies. Web development and native iOS apps currently occupy most of his time.

More from the author
Angular Services
Intermediate
2h 28m
Nov 19, 2018
RxJS: Getting Started
Intermediate
3h 4m
Sep 27, 2018
Web Development: Executive Briefing
Beginner
30m
Jul 31, 2018
More courses by Brice Wilson
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is Brice Wilson, and welcome to my course, TypeScript In-depth. I'm a server and client-side web developer. In this course we're going to start with the basics and explore all of the major areas of the TypeScript programming language. TypeScript is a superset of JavaScript. Its emphasis on strong typing and advanced language constructs help us write client and server-side code with fewer errors. TypeScript is cross-platform, open source, and compiles to JavaScript that is compatible with every major browser and popular JavaScript framework. Some of the major topics that we will cover include functions, interfaces, classes, modules and namespaces, and generics. By the end of this course, you'll be ready to begin building your next client-side Web application or server-side Node app with all of the productivity and type safety benefits you get with TypeScript. Before beginning this course, you should be familiar with the basics of JavaScript, but you certainly don't need to be an expert. I hope you'll join me on this journey to learn TypeScript with the TypeScript In-depth course at Pluralsight.

Introduction
Hi. My name is Brice Wilson. Welcome to TypeScript In-depth. I love writing TypeScript code, and I hope after watching this course you will too. It's an amazing strongly-typed language that compiles the plain-old JavaScript so you can run it in any web browser or on a server in a Node. js application. TypeScript has been around for several years now, but the last couple of years have seen amazing progress and brought some fundamental changes to the syntax and structure for many key features. In this course, I'll start with the absolute basics and gradually cover all of the major features of the language. TypeScript is the recommended language for developing Angular 2 applications and also works great with other frameworks and libraries like React and jQuery. So whether you're working with popular client-side frameworks, building server-side Node applications, or just want a better version of JavaScript, TypeScript is the answer.

Installation and Setup
Hi. This is Brice Wilson. Welcome back. In this module, I'm going to cover the very basic things every developer needs to do to get started writing TypeScript code. This includes installing TypeScript, as well as selecting and configuring your development environment. There are lots of editors that provide excellent support for TypeScript, and I'll show you how to configure, as well as write and compile TypeScript code in several of them. I'll start things off with a quick demo showing you how to install TypeScript. It's a very straightforward process and only takes a minute once you have Node and npm installed. I'll then go over some of the very good options available for editing TypeScript code, and walk through the process of using several of the most popular editors. I'll show you how to get started with Visual Studio, Sublime Text, WebStorm, and Visual Studio Code. Let's get started by installing TypeScript.

TypeScript Basics
Hi. This is Brice Wilson. In this module we're going to cover some of the basic features of TypeScript, such as how to declare variables and types, and how to work with the central data structures like arrays and enums. You can't write code without variables, so we'll start by saying how to declare variables and constants in TypeScript. Every JavaScript developers is familiar with var, but TypeScript also includes the keywords let and const, which are part of ES2015. We'll see how they all work and the benefits of using one over another. You can't have TypeScript without types, so we'll also see how to specify types for both variables and functions, and how they help us write better code with fewer errors. I'll wrap up this module with a look at some of the basic data structures built into TypeScript. The language includes support for enums, and add some functionality to the arrays all JavaScript developers know and love. We'll also take a look at a specialized version of arrays known as tuples. Let's get started by seeing how to declare variables with let and const.

Functions
Hi. This is Brice Wilson. In this module we're going to cover TypeScript functions. Functions are obviously very important in just about every programming language. At first glance it may not look like TypeScript functions are very different from JavaScript functions, thankfully they are very similar, much like the rest of TypeScript, but there are some very nice additional features that TypeScript offers when working with functions to make your code more understandable and error free. I'll start this module by highlighting some of the similarities and differences between functions in TypeScript and JavaScript. Perhaps the most obvious difference is that TypeScript functions let you specify types for function parameters, as well as the value returned from the function. We'll see how to do that, and then dive into arrow functions, which provide a nice concise syntax when you just need an anonymous or simple callback function. The type system in TypeScript lets us use types for functions just like you use types for variables. We'll see how to define those types and declare function variables that use them. Parameters are one area where TypeScript adds lots of new functionality. I've already mentioned that you can specify types for function parameters, but you can also explicitly declare parameters as optional and assign them default values if you like. Rest parameters are a feature added to ECMAScript 2015 that TypeScript also adopted. They provide a mechanism for a function to accept a variable number of parameters that will be collected into an array. The final topic I'll cover in this module is function overloading. Many languages with strong type systems allow some form of function overloading, which lets you give similar functions the same name. There's lots to cover. Let's get started.

Interfaces
Hello. Welcome back. This module will be all about interfaces. Interfaces play an important role in TypeScript by giving us a means to define our own types, types that the TypeScript compiler can then check for us and make sure we're using correctly. I'll begin this module by defining exactly what an interface is, and the reasons why we need them. That will lead us into a brief discussion of duck typing and how it applies to TypeScript. We'll then get to the actual syntax for declaring interfaces, both for general types, as well as function types. Interfaces can also be extended and composed from other interfaces, and we'll see how to do that as well. I'll wrap up this module with a brief look at classes and how you can use them to implement an interface.

Classes
Hi, this is Brice Wilson. Welcome back. In this module I'm going to cover TypeScript classes. Classes are a very natural extension to interfaces and implement a pattern JavaScript developers have hacked together in lots of different ways over the years. I'll start this module by explaining what classes are and the role they play in TypeScript development. Since classes should be a familiar concept to object-oriented developers, I'll briefly describe how TypeScript classes are similar to classes in other popular languages. I'll discuss the different types of class members, constructors, properties, and methods, and then discuss the concept of inheritance and how we can extend TypeScript classes into new classes. I'll wrap up with a look at abstract classes and class expressions.

Modules and Namespaces
Hi, this is Brice Wilson. In this module I'm going to cover modules and namespaces. We all want to write well-organized and reusable code, and these are the two features in TypeScript that help us do that. The definition of modules in TypeScript has evolved over time, so I'm going to start with a brief history lesson about modules so you're at least familiar with some of the older terms that were used to refer to modules and namespaces. I'll then talk about some of the high-level differences in modules and namespaces, and when you might want to use one over the other. After that we'll get into the details and see how to create and use namespaces, and then do the same thing with modules. Let's get started.

Generics
Welcome back. This is Brice Wilson. In this module I'm going to cover generics and show you how you can write functions, classes, and interfaces once, but have them operate over lots of different types. I'm going to start this module by defining generics and why they are useful. That will naturally lead to a discussion of type parameters, since they're the construct used to define generics. From there, I'll show you how to use generic functions, as well as generic classes and interfaces. I'll wrap up the module by showing you how to apply constraints to generics so that they only work over a subset of all possible types.

Compiler Options and Project Configuration
Welcome back. In this module I'm going to talk about TypeScript compiler options, and how you can use a special file named tsconfig. json to configure your TypeScript projects. I'm going to start by covering several different compiler options. There are lots of different options, and I'm only going to cover a few of the most common ones, but I will show you where you can find more information about all of the available options, so you can explore them on your own and know where to find help with them when you need it. I'll then cover how to create and use a tsconfig. json file to configure your TypeScript projects. They're very much related to compiler options, since most of what they contain are the options you want to use when your code is compiled to JavaScript. The other thing you can do with tsconfig files is specify which files should be included or excluded in the compilation process. We'll see how to do all of that.

Type Definitions
Hello, and welcome back. In this final module of the course, I'm going to talk about type definitions. In case you haven't noticed, there is a lot of JavaScript out in the world. Type definitions let you take advantage of all that code and easily incorporate JavaScript libraries into your TypeScript projects. I'll start by talking about the role type definitions play in TypeScript development, and then present DefinitelyTyped, which is a huge repository of type definition files for just about any JavaScript library you can imagine. Type definition files can be downloaded directly from the DefinitelyTyped GitHub repo, and a couple of tools have been developed to make obtaining and managing them a little easier. I'll first show you the basics of working with the tsd type definition manager, and then we'll take a look at a newer tool named typings. Let's get started by talking about exactly what type definition files are.