TypeScript
All versions:















TypeScript features
Main features released for TypeScript since version 4
TypeScript main features on each release are listed below, click on each version title to see the features.
TypeScript 5.4 (2024)
Import Attributes
Allows specifying attributes for imports
import jsonData from "./data.json" with { type: "json" };
const Contextual Keyword
Allows const
in more contexts
const obj = { key: "value" } as const;
TypeScript 5.3 (2023)
Decoupled Type and Function Parameter Lists
Allows separating types and function parameters
function foo<T>(x: T) {}
New decorators syntax
Updated decorator implementation
@sealed
class MyClass {}
TypeScript 5.2 (2023)
Explicit Resource Management
Adds using
for resource cleanup
using resource = new SomeResource();
TypeScript 5.1 (2023)
Easier Implicit Returns for void
Functions
No longer requires return
for void functions
function logMessage(): void {
console.log("Hello");
}
TypeScript 5.0 (2023)
Enum Unions as Discriminants
Allows union types to be used in discriminated unions
type Shape = { kind: "circle", radius: number } | { kind: "square", side: number };
New decorators
Standardized decorator support
@sealed
class MyClass {}
TypeScript 4.9 (2022)
satisfies
Operator
Ensures type compatibility without altering type inference
const palette = {
primary: "#ff0000",
} satisfies Record<string, string>;
TypeScript 4.8 (2022)
Improved Inference for Object Methods
Better inference for method assignments
const obj = {
method() {
return "Hello";
},
};
TypeScript 4.7 (2022)
ECMAScript Module Support in Node.js
Enables native ESM support
import { readFile } from "fs/promises";
TypeScript 4.6 (2022)
Control Flow Analysis for Destructured Variables
Improves type narrowing for destructuring
function process(obj: { x?: number }) {
if (obj.x) {
const { x } = obj;
console.log(x.toFixed());
}
}
TypeScript 4.5 (2021)
Awaited
Utility Type
Extracts the resolved type from a promise
type Data = Awaited<Promise<string>>;
TypeScript 4.4 (2021)
Exact Optional Property Types
Optional properties no longer allow undefined
implicitly
interface User {
name?: string;
}
TypeScript 4.3 (2021)
Override Keyword
Enforces correct method overriding
class Base {
greet(): void {}
}
class Derived extends Base {
override greet(): void {}
}
TypeScript 4.2 (2021)
Template Literal Type Improvements
Supports better type inference
type Color = "red" | `light${string}`;
TypeScript 4.1 (2020)
Template Literal Types
Allows type-safe string manipulation
type Greeting = `Hello, ${string}!`;
TypeScript 4.0 (2020)
Variadic Tuple Types
Supports tuple manipulation
type MyTuple = [string, ...number[]];
All versions:














