tutorial series

How To Code in TypeScript
  • By Jonathan Cardoso

  • TypeScript is an extension of the JavaScript language that uses JavaScript’s runtime with a compile-time type checker. This combination allows developers to use the full JavaScript ecosystem and language features, while also adding optional static type-checking, enum data types, classes, and interfaces.

    This series will show you the syntax you need to get started with TypeScript, allowing you to leverage its typing system to make scalable, enterprise-grade code.

    Published on March 16, 2021 · Updated on March 16, 2021

    TypeScript is an extension of the JavaScript language that uses JavaScript’s runtime with a compile-time type checker. This combination allows developers to use the full JavaScript ecosystem and language features, while also adding optional static type-checking, enum data types, classes, and interfaces. This tutorial will go through type declaration and all the basic types used in TypeScript.

    Published on March 25, 2021 · Updated on March 25, 2021

    Though the basic types in TypeScript will cover many use cases, creating your own custom types based on these basic types will allow you to ensure the type checker validates the data structures specific to your project. This tutorial will show you how to use custom types with TypeScript, how to compose those types together with unions and intersections, and how to use utility types to add flexibility to your custom types.

    Published on April 13, 2021

    TypeScript fully supports the existing JavaScript syntax for functions, while also adding type information and function overloading as new features. Besides providing extra documentation to the function, type information will also decrease the chances of having bugs. In this tutorial, you will start by creating the most basic functions with type information, then move on to more complex scenarios, like using rest parameters and function overloading.

    Published on June 14, 2021

    In TypeScript, enums, or enumerated types, are data structures of constant length that hold a set of constant values. Each of these constant values is known as a member of the enum. Enums are useful when setting properties or values that can only be a certain number of possible values. This tutorial will explain the syntax used to create enum types, the JavaScript code that the TypeScript compiler creates under the hood, and a use case for enums in game development.

    Published on July 9, 2021

    Classes are a common abstraction used in object-oriented programming (OOP) languages to describe data structures known as objects. TypeScript has full support for class syntax and also adds features on top of it, like member visibility, abstract classes, generic classes, arrow function methods, and a few others. This tutorial will go through the syntax used to create classes, the different features available, and how classes are treated in TypeScript during the compile-time type-check.

    Published on September 16, 2021

    Decorators are a way to decorate members of a class, or a class itself, with extra functionality. This tutorial covers creating decorators in TypeScript for classes and class members, and also how to use them.

    Published on October 1, 2021

    Interfaces in TypeScript enable you to represent and document various data structures. In this tutorial, you’ll create interfaces, learn how to use them, explore the differences between normal types and interfaces, and learn about declaration merging and module augmentation.

    Published on November 16, 2021

    Generics are a fundamental feature of statically-typed languages, allowing developers to pass types as parameters to a type, function, or other structure. TypeScript fully supports generics as a way to introduce type-safety into components that accept arguments and return values whose type will be indeterminate until they are consumed later in your code. In this tutorial, you will try out real-world examples of TypeScript generics to make your code more re-usable.

    Published on February 1, 2022

    In TypeScript, you can use namespaces to organize your code. Previously known as internal modules, namespaces in TypeScript are based on an early draft of ECMAScript modules. In this tutorial, you will create and use namespaces to illustrate the syntax and what they can be used for. It will lead you through code samples of declaring and merging namespaces, how namespaces work as JavaScript code under the hood, and how they can be used to declare types for external libraries without typing.