Hacker News new | ask | show | jobs
by AprilArcus 1204 days ago
Template literal types (a) have nothing to do with tagged template literals, and (b) are a game-changing feature, allowing you to write compile-time string parsers.
1 comments

> allowing you to write compile-time string parsers

I’m not entirely sure this is a good thing. But it’s certainly convenient in some instances.

It’s a cutesy thing that basically always comes with a “don’t actually do/use this!” disclaimer. The thing that’s actually good about template literal types is that they allow for modeling a whole class of real world JS that wasn’t possible otherwise. That is and always has been the fundamental goal of TS.
I, for one, love that my ORM can statically check my SQL statements.