HiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-23 days agoWhy make it complicated?lemmy.mlimagemessage-square119linkfedilinkarrow-up1364arrow-down139file-text
arrow-up1325arrow-down1imageWhy make it complicated?lemmy.mlHiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-23 days agomessage-square119linkfedilinkfile-text
minus-squarecalcopiritus@lemmy.worldlinkfedilinkarrow-up1·2 days agoI don’t know typescript. But if that’s the case, this meme doesn’t make much sense. Who writes the types of variables in a language with type inference unless forced by the compiler?
minus-squareVictor@lemmy.worldlinkfedilinkarrow-up1·2 days agoMaybe it’s a language without type interference? Either way, it sometimes makes sense in TypeScript to help the type system out a little bit. let array: string[] = []; In this situation, the type system can’t infer that the empty array should be a string array, because there are no items to go by.
I don’t know typescript. But if that’s the case, this meme doesn’t make much sense.
Who writes the types of variables in a language with type inference unless forced by the compiler?
Maybe it’s a language without type interference?
Either way, it sometimes makes sense in TypeScript to help the type system out a little bit.
let array: string[] = [];
In this situation, the type system can’t infer that the empty array should be a
string
array, because there are no items to go by.