Does <Show> narrow types in typescript?

I am getting undefined errors even though I wrap it in a show block.
7 Replies
lxsmnsyc
lxsmnsyc16mo ago
A plain Show won't narrow props because TS doesn't see Show as a native way to eliminate types (compared to `if-else') You can use Show's callback form though
Raqueebuddin Aziz
without a key?
lxsmnsyc
lxsmnsyc16mo ago
not until 1.7 which is the upcoming release
Raqueebuddin Aziz
got it thanks
Max
Max16mo ago
Anyone know any good workarounds? Suppose you had some accessor for a union of 10-20.. different object types easily identifiable by one property.
Raqueebuddin Aziz
thats exactly my usecase gotta wait for 1.7 I guess