codeinabox@programming.dev to Programming@programming.devEnglish · 17 days agoI keep tripping over “true, false, true”allthingssmitty.comexternal-linkmessage-square28linkfedilinkarrow-up164
arrow-up164external-linkI keep tripping over “true, false, true”allthingssmitty.comcodeinabox@programming.dev to Programming@programming.devEnglish · 17 days agomessage-square28linkfedilink
minus-squareFizzyOrange@programming.devlinkfedilinkarrow-up1·16 days agoYeah I do wonder if we need an easier way to declare these things because programmers are lazy and even in Rust I wouldn’t always bother. You can kind of do it in Typescript with strings: function create_user(role: "admin" | "normal") But of course the downside is they are strings at runtime. I’m sure it’s possible though.
Yeah I do wonder if we need an easier way to declare these things because programmers are lazy and even in Rust I wouldn’t always bother.
You can kind of do it in Typescript with strings:
function create_user(role: "admin" | "normal")But of course the downside is they are strings at runtime. I’m sure it’s possible though.