TypeScript

TypeScript lets you write JavaScript the way you really want to. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.

Any browser. Any host. Any OS. Open Source.

COURSES 2

WATCH John Lindquist's COURSE

Up and Running with TypeScript

Up and Running with TypeScript

The first question you ask after installing TypeScript is "What do I do now?" In this course you'll learn about using the TypeS...

14 lessons

WATCH Ari Picker's COURSE

Use Types Effectively in TypeScript

Use Types Effectively in TypeScript

TypeScripts purpose, the reason it exists, is to add a solid type system on top of ECMAScript 6+. JavaScript is a dynamically t...

10 lessons

Understand lookup types in TypeScript

Lookup types, introduced in TypeScript 2.1, allow us to dynamically create types based on the property keys of an object. We'll use the function spyOn from Jest to illustrate how lookup types can t...

Alex Jover Morales
1:55

Deep Copy aka Clone objects using TypeScript

You can create copies of JavaScript objects by coping around properties e.g. const x = {foo: 123}; const y = { foo: x.foo }. However doing this manually for deep objects can be time consuming. In t...

Basarat Ali Syed
2:25

Create high quality npm packages using TypeScript

The TypeScript compiler makes it super easy to create high quality NodeJS packages that can be used with compile time safety in other TypeScript packages. Using JavaScript packages written in Type...

Basarat Ali Syed
3:54

Generics using TypeScript

In this lesson we cover the key reason why programming languages need generics. We then show how use them effectively with TypeScript. We show plenty of examples where generics prevent common progr...

Basarat Ali Syed
5:16

Getting started with Jest using TypeScript

Jest is a painless JavaScript unit testing framework from Facebook. It is designed to be super easy to setup and is packed full of powerful features. In this lesson we see how easy it is to add to ...

Basarat Ali Syed
3:17

Serialize objects to JSON

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. Doing JSON serialization and de...

Basarat Ali Syed
4:32

Using ES6 and ESNext with TypeScript

TypeScript is very particular about what is and isn't allowed in a TS file to protect you from common developer errors. By default if you set the compile target to ES5 it only allows you to use glo...

Basarat Ali Syed
2:49

Create a fluent API using TypeScript classes

You can create an easy to chain API using TypeScript classes. Learn about the this return type annotation and how it plays with function chaining and class inheritance.

Basarat Ali Syed
3:09

Using TypeScript for pure JavaScript

TypeScript can actually be used just as a JavaScript -> JavaScript Transpiler e.g. ES6 -> ES5. This allows you to easily maintain your old JavaScript code base along with potentially upliftin...

Basarat Ali Syed
2:15

Create stateful React Components using TypeScript

You can create stateful React Components in TypeScript by extending from the React.Component class. This parent class takes two generic parameters, Props and State. This lessons shows these gener...

Basarat Ali Syed
2:56

Increase TypeScript's type safety with noImplicitAny

TypeScript tries to infer as much about your code as it can. But sometimes there really is not enough context for it to infer reliably. If it tried to do such inference it would potentially result...

Basarat Ali Syed
2:24

Create stateless React components using TypeScript

You can create a stateless React component in TypeScript by just creating a function. But if you want to create high quality idiomatic React + TypeScript components you should use the React.State...

Basarat Ali Syed
1:13

Browse all TypeScript lessons.

showing All 60 lessons...

Understand lookup types in TypeScript

Binary Search Algorithm using TypeScript

Quicksort algorithm using TypeScript

Create random integers in a given range

Find the repeated item in an array using TypeScript

Merge sort algorithm using TypeScript

Insertion sort algorithm using TypeScript

Bubble sort using TypeScript

Determine if a string is a palindrome

Determine if two strings are an anagram

Deep Copy aka Clone objects using TypeScript

Case insensitive sorting for string arrays

Create high quality npm packages using TypeScript

Generics using TypeScript

Sorting arrays in TypeScript

Getting started with Jest using TypeScript

Serialize objects to JSON

Coding interview: FizzBuzz problem and its solution

Using ES6 and ESNext with TypeScript

Create a fluent API using TypeScript classes

Using TypeScript for pure JavaScript

Create stateful React Components using TypeScript

Increase TypeScript's type safety with noImplicitAny

Create stateless React components using TypeScript

Bootstrap a TypeScript + React Project

Use the never type to avoid code with dead ends using TypeScript

Install TypeScript declarations from npm

Make usages of "this" safe in class methods

Catch unsafe use of "this" in TypeScript functions

Simplify asynchronous callback functions using async/await

Practical Generics in TypeScript

The Basics of Generics in TypeScript

Sharing Class Behavior with Inheritance in TypeScript

Using Interfaces to Describe Types in TypeScript

Union Types and Type Aliases in TypeScript

Using Assertion to Convert Types in TypeScript

Distinguishing between types of Strings in TypeScript

Using Type Inference in TypeScript

Creating a Class in TypeScript

Introduction to Static Typing

Function Overloads in Typescript

P

TypeScript - Generating Definition Files

P

TypeScript - Definition Files

P

TypeScript - Understanding Decorators

P

Compiling TypeScript with WebStorm

P

Installing TypeScript and Running the TypeScript Compiler (tsc)

TypeScript - Using Typings and Loading From node_modules

P

TypeScript - Reflection and Decorator Metadata

P

Using Lodash in TypeScript with Typings and SystemJS

P

TypeScript - Using Exclude and RootDir until File Globs Lands in 2.0.

P

Understand lookup types in TypeScript

1:55 typescript

Lookup types, introduced in TypeScript 2.1, allow us to dynamically create types based on the property keys of an object. We'll use the function spyOn from Jest to illustrate how lookup types can type-safe function parameters.

typescript tutorial about Binary Search Algorithm using TypeScript

Binary Search Algorithm using TypeScript

3:05 typescript

Binary search is a very fundamental algorithm in Computer Science. It powers BSTs (binary search trees) which form the basis of modern databases and immutable data structures. Binary search works very much the way humans intuitively search for a name in a yellow pages directory (if you have ever seen one) or the dictionary.

In this lesson we look at the core Binary Search Algorithm describing the problem it solves.

typescript tutorial about Quicksort algorithm using TypeScript

Quicksort algorithm using TypeScript

5:49 typescript

Quicksort (also called partition sort and pivot sort) is arguably the most used sorting algorithm. It is the one commonly implemented internally in language runtimes. In this lesson we cover the quick sort algorithm, why is it called quick and how to implement it using TypeScript / JavaScript.

typescript tutorial about Create random integers in a given range

Create random integers in a given range

1:53 typescript

Learn how to create random integers using JavaScript / TypeScript.

typescript tutorial about Find the repeated item in an array using TypeScript

Find the repeated item in an array using TypeScript

1:44 typescript

Say you have an array that has at least one item repeated. How would you find the repeated item. This is a question commonly presented to beginner developers. Here we discuss the elegant solution to this problem.

typescript tutorial about Merge sort algorithm using TypeScript

Merge sort algorithm using TypeScript

5:39 typescript

MergeSort is a famous example of a divide and conquer algorithm. In this lesson we cover the merge sort algorithm, how it gets its name, and how to implement it using TypeScript / JavaScript.

typescript tutorial about Insertion sort algorithm using TypeScript

Insertion sort algorithm using TypeScript

3:43 typescript

Insertion sort is a very intutive algorithm as humans use this pattern naturally when sorting cards in our hands.

In this lesson we cover the insertion sort algorithm, how it gets its name, and how to implement it using TypeScript / JavaScript.

typescript tutorial about Bubble sort using TypeScript

Bubble sort using TypeScript

3:25 typescript

Bubble sort is considered the simplest sorting algorithm to implement.

In this lesson we cover the bubble sort algorithm, how it gets its name, and how to implement it using TypeScript / JavaScript.

typescript tutorial about Determine if a string is a palindrome

Determine if a string is a palindrome

3:35 typescript

A palindrome is a string that reads the same forward and backward, for example, radar, toot, and madam. In this lesson we discuss how to approach the palindrome problem using TypeScript / JavaScript.

We also discuss a more complex algorithmic challenge of writing a function to check if any permutation of a given string is a palindrome.

typescript tutorial about Determine if two strings are an anagram

Determine if two strings are an anagram

3:52 typescript

The anagram test is commonly used to demonstrate how an naive implementation can perform significant order of magnitudes slower than an efficient one.

A word is an anagram of another if you can rearrange its characters to produce the second word. Here we write a function that given two strings determines if they are anagrams of each other.

typescript tutorial about Deep Copy aka Clone objects using TypeScript

Deep Copy aka Clone objects using TypeScript

2:25 typescript

You can create copies of JavaScript objects by coping around properties e.g. const x = {foo: 123}; const y = { foo: x.foo }. However doing this manually for deep objects can be time consuming. In this lesson we cover one way of deep copying simple objects in TypeScript.

typescript tutorial about Case insensitive sorting for string arrays

Case insensitive sorting for string arrays

1:33 typescript

We look at the default Array.prototype.sort behavior and discuss how you can do case insensitive string sorting.

typescript tutorial about Create high quality npm packages using TypeScript

Create high quality npm packages using TypeScript

3:54 typescript

The TypeScript compiler makes it super easy to create high quality NodeJS packages that can be used with compile time safety in other TypeScript packages.

Using JavaScript packages written in TypeScript can save you a lot of time digging around docs and then having to memorize the docs, in order to call the functions with the right spellings. This frees you up for a higher level of thinking and reasoning about logic and business requirements.

typescript tutorial about Generics using TypeScript

Generics using TypeScript

5:16 typescript

In this lesson we cover the key reason why programming languages need generics. We then show how use them effectively with TypeScript. We show plenty of examples where generics prevent common programming mistakes.

typescript tutorial about Sorting arrays in TypeScript

Sorting arrays in TypeScript

3:54 typescript

In this lesson we cover all the details of how to sort a list of items using TypeScript. We also present a few tricks to make your sort logic more readable and maintainable using TypeScript.

typescript tutorial about Getting started with Jest using TypeScript

Getting started with Jest using TypeScript

3:17 typescript

Jest is a painless JavaScript unit testing framework from Facebook. It is designed to be super easy to setup and is packed full of powerful features. In this lesson we see how easy it is to add to your TypeScript project. This will be followed by a quick example application.

typescript tutorial about Serialize objects to JSON

Serialize objects to JSON

4:32 typescript

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.

Doing JSON serialization and deserialization in JavaScript and TypeScript is super easy as it is a format essentially designed for this language. This lesson covers the JSON.stringify primitive provided by JavaScript runtimes.

typescript tutorial about Coding interview: FizzBuzz problem and its solution

Coding interview: FizzBuzz problem and its solution

4:19 typescript

The FizzBuzz problem is commonly presented as the lowest level of comprehension required to illustrate adequacy in computer programming.

In this lesson you learn about the problem as well as its solution in TypeScript. We will also cover some tricks on approaching the problem and coding interview questions in general.

typescript tutorial about Using ES6 and ESNext with TypeScript

Using ES6 and ESNext with TypeScript

2:49 typescript

TypeScript is very particular about what is and isn't allowed in a TS file to protect you from common developer errors. By default if you set the compile target to ES5 it only allows you to use globally defined variables that were available in the ES5 time-frame. That said it is super easy to configure TypeScript to use ES6 or ESNext using the lib option.

We also cover how to make sure that these features work across the widest range of browsers using a simple polyfill.

typescript tutorial about  Create a fluent API using TypeScript classes

Create a fluent API using TypeScript classes

3:09 typescript

You can create an easy to chain API using TypeScript classes. Learn about the this return type annotation and how it plays with function chaining and class inheritance.

typescript tutorial about Using TypeScript for pure JavaScript

Using TypeScript for pure JavaScript

2:15 typescript

TypeScript can actually be used just as a JavaScript -> JavaScript Transpiler e.g. ES6 -> ES5. This allows you to easily maintain your old JavaScript code base along with potentially uplifting to a TypeSafe version using a single compiler.

typescript tutorial about Create stateful React Components using TypeScript

Create stateful React Components using TypeScript

2:56 typescript

You can create stateful React Components in TypeScript by extending from the React.Component class. This parent class takes two generic parameters, Props and State.

This lessons shows these generic parameters and React.Component in action

typescript tutorial about Increase TypeScript's type safety with noImplicitAny

Increase TypeScript's type safety with noImplicitAny

2:24 typescript

TypeScript tries to infer as much about your code as it can.

But sometimes there really is not enough context for it to infer reliably. If it tried to do such inference it would potentially result in more nuisance than help. So instead it infers the type any. This type can catch people off guard as it provides very little type safety. Fortunately TypeScript has a flag to make it easier to catch such unsafe code at development time.

typescript tutorial about Create stateless React components using TypeScript

Create stateless React components using TypeScript

1:13 typescript

You can create a stateless React component in TypeScript by just creating a function.

But if you want to create high quality idiomatic React + TypeScript components you should use the React.StatelessComponent interface. This is demonstrated in the video.

typescript tutorial about Bootstrap a TypeScript + React Project

Bootstrap a TypeScript + React Project

5:54 typescript

Setup a TypeScript + React project from scratch using webpack. Learn the reason behind every line that you need to type and become an expert.

typescript tutorial about Use the never type to avoid code with dead ends using TypeScript

Use the never type to avoid code with dead ends using TypeScript

1:24 typescript

Programming language design does have a concept of bottom type that is a natural outcome as soon as you do code flow analysis. TypeScript does code flow analysis (😎) and so it needs to reliably represent stuff that might never happen. This is what the never type is all about.

typescript tutorial about Install TypeScript declarations from npm

Install TypeScript declarations from npm

1:31 typescript

This lesson shows you how to acquire type declaration files for your TypeScript projects directly from npm.

typescript tutorial about Make usages of "this" safe in class methods

Make usages of "this" safe in class methods

0:59 typescript

this is determined by how you call a function. To write class methods that can always safely use this you can use the TypeScript property initializer syntax along with arrow functions.

typescript tutorial about Catch unsafe use of "this" in TypeScript functions

Catch unsafe use of "this" in TypeScript functions

1:04 typescript

this is probably the most tricky thing to use in JavaScript and therefore TypeScript. Fortunately there is a TypeScript compiler flag noImplicit this that can help catch unsafe usages so beginners don't get caught off guard.

typescript tutorial about Simplify asynchronous callback functions using async/await

Simplify asynchronous callback functions using async/await

1:48 typescript

Learn how to write a promise based delay function and then use it in async await to see how much it simplifies code over setTimeout.

Lets say you want to call a function after 1s, 2s, 3s. You can use setTimeout, or you can wrap it up into a simple delay function that works with async/await

typescript tutorial about Practical Generics in TypeScript

Practical Generics in TypeScript

2:52 typescript

Typescript generics are great for writing code that accepts any type. How do we write code that doesn’t accept any type, but instead accepts a range of types? In this lesson we learn how to use generic classes, interfaces and constraints to be more specific with our Typescript generics.

typescript tutorial about The Basics of Generics in TypeScript

The Basics of Generics in TypeScript

2:07 typescript

It can be painful to write the same function repeatedly with different types. Typescript generics allow us to write 1 function and maintain whatever type(s) our function is given. This lesson covers syntax and a basic use case for Typescript generics.

typescript tutorial about Sharing Class Behavior with Inheritance in TypeScript

Sharing Class Behavior with Inheritance in TypeScript

3:42 typescript

Typescript classes make inheritance much easier to write and understand. In this lesson we look into how to set up inheritance with Typescript classes, extends and super.

typescript tutorial about Using Interfaces to Describe Types in TypeScript

Using Interfaces to Describe Types in TypeScript

3:32 typescript

It’s easy to pass the wrong value to a function. Typescript interfaces are great because they catch errors at compile time or in an IDE. In this lesson we’ll learn how to describe a type shape with Typescript interfaces.

typescript tutorial about Union Types and Type Aliases in TypeScript

Union Types and Type Aliases in TypeScript

5:01 typescript

Sometimes we want our function arguments to be able to accept more than 1 type; e.g. a string or an array. This lesson will show us how to assign more than 1 type to a variable with Typescript union types and type aliases.

typescript tutorial about Using Assertion to Convert Types in TypeScript

Using Assertion to Convert Types in TypeScript

2:09 typescript

Sometimes the compiler needs help figuring out a type. In this lesson we learn how to help out the compiler with Typescript type assertion.

typescript tutorial about Distinguishing between types of Strings in TypeScript

Distinguishing between types of Strings in TypeScript

2:02 typescript

In JavaScript, many libraries use string arguments to change behavior. In this lesson we learn how Typescript catches string related errors at compile time by assigning a string literal as a type.

typescript tutorial about Using Type Inference in TypeScript

Using Type Inference in TypeScript

2:52 typescript

This lesson explains how the Typescript compiler uses inference to guess what types we’re using, so we don’t have to annotate all the things.

typescript tutorial about Creating a Class in TypeScript

Creating a Class in TypeScript

4:00 typescript

Typescript classes make traditional object oriented programming easier to read and write. In this lesson we learn about class syntax, what the constructor is and some interesting variable features.

typescript tutorial about Introduction to Static Typing

Introduction to Static Typing

1:39 typescript

This is a basic introduction to static typing with Typescript.
In this lesson we will learn about simple types in TypeScript.

typescript tutorial about Function Overloads in Typescript

Function Overloads in Typescript

3:46 typescript PRO

It's common in Javascript for functions to accept different argument types and to also return different types. In this lesson we learn how to 'teach' Typescript about these dynamic functions so that we can still benefit from the powerful static type analysis.

typescript tutorial about TypeScript - Generating Definition Files

TypeScript - Generating Definition Files

2:41 typescript PRO

TypeScript allows you to generate definition files for your own libraries. This lesson shows you how to organize your project and generate the definition files so that others projects can use your library with TypeScript.

typescript tutorial about TypeScript - Definition Files

TypeScript - Definition Files

5:51 typescript PRO

TypeScript definition files can be an extremely confusing topic to tackle due to the sheer variety and of features and libraries they need to cover. This lesson helps you understand definition files, how they're used, and where to find them based on many different scenarios.

typescript tutorial about TypeScript - Understanding Decorators

TypeScript - Understanding Decorators

3:23 typescript PRO

Decorators are a feature of TypeScript that are becoming more and more common in many major libraries. This lesson walks you through what decorators are and how to create your own.

typescript tutorial about Compiling TypeScript with WebStorm

Compiling TypeScript with WebStorm

1:31 typescript PRO

As long as you have a properly configured .tsconfig, most tooling can just run tsc behind the scenes to build your project. This lesson shows how WebStorm includes a nice interface for reporting and navigating to the errors and will continuously run your TypeScript build for you.

typescript tutorial about Installing TypeScript and Running the TypeScript Compiler (tsc)

Installing TypeScript and Running the TypeScript Compiler (tsc)

1:59 typescript

This lesson shows you how to install TypeScript and run the TypeScript compiler against a .ts file from the command line.

typescript tutorial about TypeScript - Using Typings and Loading From node_modules

TypeScript - Using Typings and Loading From node_modules

4:44 typescript PRO

Using TypeScript when installing packages from npm often requires you to install related definition files. This lesson shows you how to use typings to install es6-shim then how to configure SystemJS to load from node_modules.

typescript tutorial about TypeScript - Reflection and Decorator Metadata

TypeScript - Reflection and Decorator Metadata

5:59 typescript PRO

TypeScript allows you to emit decorator metadata which enables more powerful features through reflection. This lesson show you how decorators and reflection fit together and how to configure your own decorators to use reflection.

typescript tutorial about Using Lodash in TypeScript with Typings and SystemJS

Using Lodash in TypeScript with Typings and SystemJS

3:38 typescript PRO

One of the most confusing parts of getting started with TypeScript is figuring out how to use all the libraries that you know and love from JavaScript. This lesson walks you through including Lodash in your project, installing Lodash definition files, and then properly loading Lodash with SystemJS.

typescript tutorial about TypeScript - Using Exclude and RootDir until File Globs Lands in 2.0.

TypeScript - Using Exclude and RootDir until File Globs Lands in 2.0.

1:48 typescript PRO

Files globs will be available in TypeScript 2.0, so in the meantime, we need to use "exclude" and "rootDir" to configure which files to load. This lesson shows how to switch from "files" to "exclude".

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?