// The interface is gone (changed by whitespace)
//
//
//
operate transfer(creature) { // ': Animal' and ': string' are stripped
if (creature.winged) {
return `${creature.identify} takes flight.`;
}
return `${creature.identify} walks the trail.`;
}
const bat = { // ': Animal' is stripped
identify: "Bat",
winged: true
};
console.log(transfer(bat));
Node’s --experimental-strip-types flag has impressed adjustments to the TypeScript spec itself, beginning with the brand new erasableSyntaxOnly flag in TypeScript 5.8. Having the experimental flag out there at runtime is one factor, however having it constructed into the language is kind of one other. Let’s contemplate the broader results of this modification.
No extra supply maps
For debugging functions, it’s important that the categories in our instance are changed with whitespace, not simply deleted. That ensures the road numbers will naturally match-up between runtime and compile time. This preservation of whitespace is greater than only a parser trick; it’s a giant win for DX.
For years, TypeScript builders relied on supply maps to translate the JavaScript operating within the browser or server again to the TypeScript supply code of their editor. Whereas supply maps usually work, they’re infamous for being finicky. They’ll break and fail to map variables accurately, resulting in issues the place the road quantity within the stack hint doesn’t match the code in your display.
