3 ms·
It's a feature that I learned to use in Python and one that I consistently now miss in other languages (rust, java, typescript, javascript).
by tasubotadas 6y ago
It's a feature that I learned to use in Python and one that I consistently now miss in other languages (rust, java, typescript, javascript).
- reificator 6y agoIn ts/js passing an object is not very much effort and doesn't add much noise to reading the code.
- KarimDaghari 6y agoHonestly, In my experience named params are better than positional ones, but then again, they’re not mutually exclusive.
- deleted 6y ago[deleted]
- wk_end 6y agoIt's annoying in TS because (AFAIK?) you need to specify the type and unpack the object: function foo({arg1, arg2, arg3}:{arg1: Thing1, arg2: Thing2, arg3: Thing3) { ... }
- KarimDaghari 6y agoYou could specify the type first (instead of doing it inline) and then unpack (if you want)