I've been trying to figure out a way to constrain what values can go into a string by type. What I need is still an infinite list, so I can't just use a string enumeration.
I tried using a type guard, and I tried using typed template tags. Neither succeeded.
I'm doing something more complicated than this, but to explain what I want, consider a system containing orders where every order has an order ID of the form "order_12345", where the preface string is always order_ and the number at the end can be arbitrarily large.
Is there a way to make a string type that can defend that at runtime with literal constant assigments?