Webber
Tutorial
HOME TYPESCRIPT JS BOM JS DOM SNIPPET ADVANCED WEB API ES6

TypeScript Tutorial

TypeScript is typed JavaScript. TypeScript adds types to JavaScript to help you speed up the development by catching
errors before you even run the JavaScript code.

TypeScript is an open-source programming language that builds on top of JavaScript. It works on any web browser,
any OS, and any environment that JavaScript runs.

In this TypeScript tutorial, you’ll learn:

  • Why TypeScript offers a lot of benefits over vanilla JavaScript.
  • Understand what TypeScript truly is and how it works under the hood.
  • Use TypeScript and its rich features like Types, Classes, Interfaces, Modules, and much more.

Prerequisites

To follow the tutorial, you need to have:

Section 1. Getting Started

What is TypeScript – learn about what typescript is and its advantages over vanilla JavaScript.

Setting up the TypeScript development environment – show you how to set up a TypeScript development environment to be more productive in TypeScript.

TypeScript Hello World – walk you through the steps to create the first program in TypeScript called Hello, World!

Why TypeScript – clearly understand why you should use TypeScript.

Section 2. Basic Types

Type Annotation – learn how to use type annotation to define the static type for variables, function parameters, and return values.

Number – learn about the numeric types including floating-point numbers and big integers.

String – show you how to use the string type in TypeScript.

Boolean – guide you on the boolean type and how to use it effectively.

Object Type – introduce you to the object type that represents non-primitive values.

Array – show you how to use an array and its operations.

Tuple – learn how to store a fixed number of elements with known types in a tuple.

Enum – show you how to define a group of named constants by using the enum type.

Any Type – learn how to use the any type to store a value of any type in a variable.

Void type – show you how to use the void type as the return type of functions that do not return any value.

Never Type – learn how to use the never type that contains no value.

Union Types – guide you on how to store a value of one or several types in a variable with the union type.

Type Aliases – show you how to define new names for types using type aliases.

String Literal Types – learn how to define a type that accepts only a specified string literal.

Type Inference – explain where and how TypeScript infers types of variables.

Section 3. Control Flow Statements

The following tutorials refresh your control flow statement knowledge. If you are already familiar with these
statements in JavaScript, please feel free to skip this section.

if…else – learn how to execute code based on a condition.

switch..case – show you how to use the switch statement to allow a number of possible execution paths.

for – create a loop that executes a specified number of times.

while – create a pretest loop that executes as long as a condition is true.

do…while – learn how to create a posttest loop that executes until a condition is false.

break – show you how to use the break statement to terminate a loop or a switch.

continue – learn how to skip to the end of a loop and continue to the next iteration.

Section 4. Functions

Functions – learn how to declare a function that uses type annotation in TypeScript.

Function types – guide you on how to use function types to define types for functions.

Optional Parameters – show you how to define functions with optional parameters.

Default Parameters – introduce you to default parameters.

Rest Parameters – use the rest parameters to handle an infinite number of arguments of a function.

Function overloadings – learn how to establish between parameter types and results of a function via function overloadings.

Section 5. Classes

Classes – learn how to construct a class in TypeScript.

Access Modifiers – introduce you to private, protected, and public access modifiers.

The readonly Modifier – learn how to use the readonly modifier to make class properties immutable.

Getters & Setters – show you how to use the getters and setters to control the access of the class properties.

Inheritance – learn how to use the inheritance to reuse the functionality of another class.

Static methods & properties – define static methods and variables shared by all instances of a class.

Abstract Classes – explain the abstract classes that define some common behaviors.

Section 6. Interfaces

Interfaces – introduce you to interfaces and how to use them for creating contracts within your code.

Extending Interfaces – learn how to extend an interface to create a combination of interfaces.

Interfaces vs. Abstract Classes – explain to you the differences between interfaces and abstract classes.

Section 7. Advanced Types

Intersection Types – show you how to create a new type that has all features of existing types.

Type Guards – learn how to use type guards to narrow the type of a variable within a conditional block.

Type Casting – show you how to use type casting to convert a variable of one type to another.

Type Assertions – guide you on how to use a type assertion to tell the compiler to treat a value as a specified type.

Section 8. Generics

Introduction to TypeScript Generics – learn how to use TypeScript generics to develop generic functions.

Generic constraints – show you how to add constraints to the generic types.

Generic Classes – guide you on how to develop generic classes.

Generic Interfaces – walk you through the steps for creating generic interfaces.

Section 9. Modules

TypeScript Modules – introduce you to modules in TypeScript and how to use them in other modules.

Section 10. TypeScript in Node.js

Node.js TypeScript – how to set up a development environment for using TypeScript in the Node.js project.

Was this tutorial helpful?

PREVIOUSLY

Copyright © 2023 by webber-Javascript Tutorial. All Right Reserved.