JS Type Checker Wish List: Regex validated strings
type HexColor = /#[0-9a-f]+/i;
const color: HexColor = '#eee'; // fine
const color: HexColor = 'red'; // error!
-
Show this thread
-
Replying to @frontsideup
If you're using a static type checker then your codebase is already covered with annotations. HexColor would just be typed as a string which doesn't given you the level of safety that this does.
1:02 PM - 13 Nov 2018
0 replies
0 retweets
2 likes
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 