Is TypeScript A Programming Language?

So, is TypeScript a Programming Language? Well, that answer can get a bit more complicated than a simple yes or no answer. In short, yes TypeScript is a programming language. There is no doubt about that. However, if you want to know exactly what type of programming language TypeScript is, and what it can and can’t do, keep reading!

So without further ado, let’s jump right in.

Is TypeScript a Programming Language?

First, let’s explain what a programming language is and how TypeScript fits into this definition.

A programming language, by definition, is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks. From this definition, we can be sure that TypeScript is a programming language, as it is used for both frontend and backend development, desktop development, and even mobile development. All software is created in the realm of programming.

Here is a little snippet of TypeScript telling the computer to print a “Hello World!” greeting:

class Greeter {
  greeting: string;
 
  constructor(message: string) {
    this.greeting = message;
  }
 
  greet() {
    return "Hello, " + this.greeting;
  }
}
 
let greeter = new Greeter("world");

TypeScript Is A Syntactical Superset of JavaScript

It’s important to understand that TypeScript is simply a superset of JavaScript which primarily provides optional static typing, classes, and interfaces. In fact, if you wanted, you could even write plain JavaScript and run it as TypeScript code.

This is because whenever you write TypeScript, you need to compile it down to JavaScript. TypeScript cannot be run anywhere until compiled down to JavaScript. Similar to how you would compile C code into binary code to run it anywhere.

For that reason, it is quite obvious to see that since JavaScript fits the description of being a programming language, TypeScript does as well.

For a better visual, the code above would look something like this once compiled down to JavaScript:

var Greeter = /** @class */ (function () {
    function Greeter(message) {
        this.greeting = message;
    }
    Greeter.prototype.greet = function () {
        return "Hello, " + this.greeting;
    };
    return Greeter;
}());
var greeter = new Greeter("World!");

TypeScript Is Turing Complete

If the above definition of a programming language didn’t satisfy you, maybe the fact that TypeScript is Turing Complete will!

Why does Turing Completeness matter? Well, a basic way to check if a programming language is truly a programming language is to check if it passes the Turing Complete test.

A system or language is only considered Turing Complete if it can do anything a universal Turing machine can. Any program that could be written to run for a Turing machine can also be written in TypeScript. Thus, TypeScript is Turing complete.

Not only is TypeScript Turing Complete, but even its type system is Turing Complete!

Is TypeScript A General Purpose Programming Language?

A general-purpose programming language is a language that can be used for creating all types of programs. As stated above, TypeScript is a very versatile language. It is used in both frontend and backend development, mobile development, and desktop development. It is also used for animations, arithmetics, APIs, and a ton of other programming applications. For that reason, it is safe to say that not only is TypeScript a programming language, but it is more specifically a general-purpose programming language.

Is TypeScript A Domain-Specific Programming Language?

A domain-specific programming language is a language built for a specific purpose. A good example of a domain-specific language (DSL) is SQL since it is used primarily for database operations.

TypeScript on the other hand is not a domain-specific language (DSL). Since it is used for a wide range of programming tasks, it does not fall under this category.

Is TypeScript A Scripting Language?

A scripting language is a programming language that is used to customize, manipulate, and/or automate the facilities of an existing system. Furthermore, the theoretical difference between a programming language and a scripting language is that scripting languages, such as JavaScript and Python, do not require compilation and are compiled at runtime.

There is a lot of debate about whether or not TypeScript is a true scripting language or not. However, since the language is transpiled into JavaScript, and can be done at runtime, I would suggest that TypeScript is in fact a scripting language. Whether you agree with that assumption given the definition is up to you.

Is TypeScript A High-Level or Low-Level Programming Language?

The difference between a high-level and low-level programming language is generally distinguished by how human-readable the code is. This means that code such as binary and assembly would be lower level and scripting languages like JavaScript and Python would be higher level. However, there is a lot of debate about what is classified as high-level and low-level programming languages. Some would even suggest that C is a high-level language; despite it being difficult to master and understand. However, there is no doubt that since JavaScript is a high-level language, that TypeScript is a high-level language as well.

Wrapping Up

So that pretty much wraps things up! TypeScript is, in fact, a programming language.

Not only is it a programming language but it is also a high-level, general-purpose, strongly typed, object-based, multi-paradigm, and transpiled programming language. If that first definition wasn’t long enough!

Hopefully, this article helped clear up any confusion you had with TypeScript, and as always, happy coding!

If you want to learn TypeScript, you can check out a ton of great TypScript tutorials here.

Grant Darling

Grant is a full-stack / frontend software developer passionate about writing & coding. He has many years experience working in the tech industry both as a freelancer and as an employee.

The Code Bytes is all about providing people with honest information about programming. To learn more about Grant, read his about page!

If you’re interested in freelance coding / writing services or want to partner with The Code Bytes, you can get in touch with me here!