Is TypeScript A Programming Language?
Tags: typescript, javascript, programming, discuss
Published: 2023-10-27 18:19:13

## Compilers & Interpreters

Unlike compiled languages, such as Rust, JavaScript is an interpreted language. In interpreted languages, there is no need for a compilation step, which is a common process in higher-level languages like Rust. High-level languages, like JavaScript, are characterized by strong abstractions that enable the hiding of complexity through a declarative approach. In contrast, lower-level languages are inherently imperative in nature.

> **Fun Fact:** The earliest references to a "high-level" programming language compiled with a compiler were often referred to as "autocodes." Notable autocodes from this era include COBOL and Fortran. You can find more information about autocodes [here](https://en.wikipedia.org/wiki/Autocode).

In today's rapidly evolving technological landscape, interpreted languages like JavaScript have seen innovative transformations. One notable example is Microsoft's TypeScript. TypeScript is unquestionably a programming language, yet it's more accurately described as a superset. A superset doesn't neatly fit into the categories of compiled or interpreted languages. This begs the question: Is TypeScript truly a language?

## Understanding Supersets: TypeScript

In the context of programming languages, what sets a superset apart from the original language? A superset can be defined as a collection of commands or functions that extend the capabilities of the original specification. To illustrate this, consider comparisons with subsets and supersets in other domains. For instance, CSS (a subset) and Sass (a superset), or the classic example, Java (subset) and Kotlin (superset), which maintain compatibility while introducing new features.

In the case of TypeScript, being a superset of JavaScript, it means that all valid JavaScript code is also valid TypeScript code. This parallels the relationship between CSS and Sass, as well as Java and Kotlin, where the former is encompassed by the latter.

If this is the case, then is TypeScript a language? The answer is **Yes, TypeScript is a programming language.**

## What Defines A Programming Language?

A programming language goes beyond a set of commands and syntax; it serves as a vital bridge between humans and computers, enabling precise communication and task instructions. It encompasses elements such as syntax, semantics, abstraction levels, execution environments (interpreters or compilers), standard libraries, community support, application domains, compatibility with other languages, and the ability to innovate and adapt.

Consider TypeScript as a prime example, where it extends the syntax and semantics of JavaScript, providing static typing while maintaining compatibility. This reflects the dynamic nature of programming languages and their capacity to evolve in response to changing needs. In a rapidly evolving technological landscape, the definition of a programming language is a dynamic concept that continuously adapts to the demands of the computing world.

## TypeScript: A Programming Language

To clarify the semantics, a superset of a programming language is inherently a programming language itself. Thus, TypeScript is unequivocally a programming language. TypeScript is considered a distinct programming language because it introduces new syntax and features that extend beyond its subset counterpart, JavaScript. Its status as a superset does not diminish its identity as a programming language; instead, it underscores its ability to build upon an existing language, providing additional capabilities and benefits.

## Supersets Are Not All the Same

It can be argued that C++ is a superset of C, and this argument holds true due to the high degree of compatibility between the two languages. C++ was designed with significant backward compatibility with C, allowing C code to be used within C++ programs without modification in many cases. This compatibility demonstrates how a "non-strict" superset can maintain a strong relationship with the original language.

In the context of programming languages and their relationships, a "strict" superset is one that not only includes all the features of the original language but also adds additional features or restrictions that make it more comprehensive or stricter in some way. On the other hand, a "non-strict" or "loose" superset maintains compatibility with the original language without necessarily introducing new features or restrictions.

TypeScript is a "strict" superset of JavaScript; C++ is a "non-strict" superset of C.

## The Takeaway

In the ever-evolving realm of technology, the dynamic nature of programming languages is a testament to their adaptability. TypeScript, as a "strict" superset of JavaScript, showcases how languages can advance while preserving compatibility with their predecessors. It underlines the essence of what defines a programming language – a bridge between human intent and machine execution. As we reflect on TypeScript's journey from a superset to a full-fledged language, we witness the transformative power of innovation within the programming world. With each advancement, programming languages continue to shape our digital landscape, responding to the ever-changing needs of the computing domain.