return type not getting inferred correctly. what am i doing wrong here?
ts playgroud link: https://slug.vercel.app/s/broken-inference
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
16 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ah but shouldn't it change the type ideally?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
did not know about
is
thats quite coolUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
thats nice, like a reusable type guard
is there a library for such common type guards?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
makes sense
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
thanks i'll give this a read
thats pretty nice
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah probably there's no point in installing a lib for such small stuff
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View