skdb
skdb copied to clipboard
Style/ts: replace `(args) => obj.method(args)` with `obj.method.bind(obj)`
In that case let's open an issue with a reminder to use that style across the board (there are instances of the lambda variant in the skipruntime client or server).
Originally posted by @beauby in https://github.com/SkipLabs/skdb/pull/345#discussion_r1781140562
With (arg1, arg2) => obj.method(arg1, arg2), I want to simplify to just obj.method and then it fails... so obj.method.bind(obj), although ugly, makes it explicit
I've had the same impulse to eta-reduce but didn't know about bind to do so safely! Seems insane that that's not the default binding behaviour for JS methods, but so it goes