JS Type Checker Wish List: Regex validated strings
type HexColor = /#[0-9a-f]+/i;
const color: HexColor = '#eee'; // fine
const color: HexColor = 'red'; // error!
The type checker I'm working on uses workers, so I could possibly detect it and kill the worker.
-
-
The language server process is always killable, but I think it's still pretty undesirable for something that easy to run into. I could imagine regex types that aren't as powerful as actual regexes.
-
You could do so much with strictly regular regexps. Another bonus: matching is simpler and way more efficient.
- 5 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 