Closed bobrippling closed 1 year ago
We can do this, but can you not just change the script that makes the typescript decls to just convert this
->thisArg
if it finds it?
Because I'd imagine we'll find that maybe more functions get added using this
as a name later on - and there is no real reason not to use it other than the typescript decls?
Nice idea, and yes, that's far more future proof. I've made that change, in both the type-generation code and the docs, so the argument name and its documentation match up still
Looks great - thank you!
this
as the first argument means the function is callable as inobj.func()
, and that we've specified the type ofobj
, rather than the type of the first argument.We can rename
this
tothisArg
to avoid this behaviour, meaning we now have a "real" first argument, that will be thethis
passed to the function we've specified.This change also restricts
apply
's second argument to be an array-like object.