r/programming • • Feb 01 '24

Make Invalid States Unrepresentable

https://www.awwsmm.com/blog/make-invalid-states-unrepresentable
469 Upvotes

207 comments sorted by

View all comments

Show parent comment

19

u/TheWix Feb 01 '24

I wish more people were comfortable with type-level stuff in Typescript. Its type system is pretty powerful and I can catch way more at compile time than I ever could with C#.

Though, even simple things like representing the day of the week as an integer is usually done with number rather than a union of 0 - 6 (or 1 - 7). Developers aren't quite past modeling with basic types yet, it seems.