
// The interface is gone (replaced by whitespace)
//
//
//
function move(creature) { // ': Animal' and ': string' are stripped
if (creature.winged) {
return `${creature.name} takes flight.`;
}
return `${creature.name} walks the path.`;
}
const bat = { // ': Animal' is stripped
name: "Bat",
winged: true
};
console.log(move(bat));Node’s --experimental-strip-types flag has inspired changes to the TypeScript spec itself, starting with the new erasableSyntaxOnly flag in TypeScript 5.8. Having the experimental flag available at runtime is one thing, but having it built into the language is quite another. Let’s consider the broader effects of this change.
No more source maps
For debugging purposes, it is essential that the types in our example are replaced with whitespace, not just deleted. That ensures the line numbers will naturally match-up between runtime and compile time. This preservation of whitespace is more than just a parser trick; it’s a big win for DX.
For years, TypeScript developers relied on source maps to translate the JavaScript running in the browser or server back to the TypeScript source code in their editor. While source maps generally work, they are notorious for being finicky. They can break and fail to map variables correctly, leading to problems where the line number in the stack trace doesn’t match the code on your screen.

