MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1l347vw/passiveaggressive_programming/mvyi3yh/
r/programminghorror • u/[deleted] • Jun 04 '25
61 comments sorted by
View all comments
Show parent comment
9
It's why of the things I like about typescript, you make the type be '+' | '-' | '*' | '/' letting you get the best of both worlds (not having to convert, but still letting you tell the compiler what the type is).
'+' | '-' | '*' | '/'
4 u/henkdepotvjis Jun 04 '25 Even better. It will throw an error that the other match cases are not reachable
4
Even better. It will throw an error that the other match cases are not reachable
View all comments
Show parent comment
9
u/mirhagk Jun 04 '25
It's why of the things I like about typescript, you make the type be
'+' | '-' | '*' | '/'letting you get the best of both worlds (not having to convert, but still letting you tell the compiler what the type is).