Bind a this to a function, with stricter typing than .bind()
In Uneventful, this is mainly used to turn generator functions into simulated
arrow functions.
Note: If your generator also needs to access the task's Work, be sure to
declare its type (e.g. boundTo(this, function*(self: Work<whatever>) {...})), even if you're using start<whatever>(), as TypeScript will
interpret an untyped argument in your function signature as never.
Bind a
thisto a function, with stricter typing than.bind()In Uneventful, this is mainly used to turn generator functions into simulated arrow functions.
Note: If your generator also needs to access the task's
Work, be sure to declare its type (e.g.boundTo(this, function*(self: Work<whatever>) {...})), even if you're usingstart<whatever>(), as TypeScript will interpret an untyped argument in your function signature asnever.