Re:Apple Developer Documentation Is Missing
by leshow on Monday October 28, 2019 @12:07PM
(#21378190)
?? doesn't exist in typescript yet, but there is a tc39 proposal to add it to js proper
Re:Apple Developer Documentation Is Missing
by AgloeDreams on Monday October 28, 2019 @02:02PM
(#21379673)
TS 3.7 adds it.
Re:Apple Developer Documentation Is Missing
by jamil7 on Monday October 28, 2019 @11:55AM
(#21378057)
Do you mean Swift? I didn't think Typescript had something like this yet.
Re:Apple Developer Documentation Is Missing
by h0h0h0h0111 on Monday October 28, 2019 @12:07PM
(#21378189)
Not sure about OP, but this is coming in Typescript 3.7 I believe. Currently you can use `||`, but as mentioned above it will also catch false, 0, "", etc
Re:Apple Developer Documentation Is Missing
by AgloeDreams on Monday October 28, 2019 @02:17PM
(#21379876)
Bingo. TS 3.7
It is awfully helpful for ensuring you handle error states in displaying API values. Additionally if you want this behavior but when the value is falsey, then you can use `||` instead.