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.
7 replies
0 recast
10 reactions

Cassie Heart pfp
Cassie Heart
@cassie
Discriminated Unions are a good feature, if only typescript had a better way to actually identify the type (I know it’s javascript’s fault it can’t, but I still wish it did)
2 replies
0 recast
4 reactions

Phil Cockfield pfp
Phil Cockfield
@pjc
Oh to have first class type reflection! Yes. There's been talk of reflection from early days in TS, and every time I've investigated it's been some cack-handed thing that was just way too wobly to base anything solid on. This seems completely possible, something like bundling "type maps" inline like "source maps"
0 reply
0 recast
1 reaction

Benjamin Lim pfp
Benjamin Lim
@benlim
Couldn't you use a custom type property to identify the type? (i.e. InlineDataPart { type: "inline" }, TextPart { type: "text" })
0 reply
0 recast
1 reaction