2 ms·
I really like that TS makes it possible to work with raw objects (~dicts) without having to worry about keys existing or not existing, especially narrowing down
by baq 2y ago
I really like that TS makes it possible to work with raw objects (~dicts) without having to worry about keys existing or not existing, especially narrowing down via Pick<> and tricks related to impossible combinations via the never type are nice (e.g. if it has key 'a', it can't have key 'b' and vice versa). That said Python's typing doesn't sit still and I tuned out a couple of years ago, so all those things might be possible today via TypedDict, haven't checked).
- rednafi 2y agoSpot on. Record types and Pick/Omit in TS is something I miss in Python. It's still not there. TypedDict solves some of the issues but it's a lot more verbose than TS and isn't half as nice.