Content pfp
Content
@
0 reply
0 recast
0 reaction

Nicholas Charriere pfp
Nicholas Charriere
@pushix
I was looking at google's new node SDK for gemini. I like this "disjoint types" pattern. A very good way to make your TypeScript very readable + meaningful, I have used something similar, but not with the "never" trick.
9 replies
0 recast
9 reactions

Darryl Yeo đŸ› ïž (at Devcon) pfp
Darryl Yeo đŸ› ïž (at Devcon)
@darrylyeo
The caveat with this “optional never” approach is that it still allows the property to be set to undefined. This may not be what you want if your logic depends on the presence or non-presence of a property, i.e. using the JavaScript “in” operator.
1 reply
0 recast
1 reaction

Nicholas Charriere pfp
Nicholas Charriere
@pushix
Very good point
0 reply
0 recast
0 reaction