Mastering Typescript 10: Advanced type system features | By Muhammad Syaoki Faradisa | March 2025

The Advanced TypeScript type system is one of its most powerful features, allowing you to create precise, flexible and reusable definitions. Let’s explore these advanced concepts in an accessible way even if you are only starting with TypeScript.
The type of functionalities and operators
These operators help you reduce types to execution and during type verification. Consider them as tools that help with a typed type with what type of data you work in different situations.
THE typeof
The operator operates in two contexts:
- Javascript Runtime: Determine the type of value during execution
- Dactylographed context: Create types based on existing values
Let’s see how it works in practice:
// JavaScript runtime context
function printValue(val: any) {
if (typeof val === "string") {
// TypeScript knows val is a string here
console.log(val.toUpperCase());
} else if (typeof val === "number") {
// TypeScript knows val is a number here
console.log(val.toFixed(2));
}
}// TypeScript type context
const user = { id: 1, name: "Alice" };
// Creates a type matching the shape of 'user'
type User = typeof user;
// Equivalent to: type User = { id: number…