Make two changes to the forBlock dictionary on CodeGenerator
objects:
- Change the type of the second argument to the special 'this'
type (was CodeGenerator), so that e.g. JS block generator
functions can call JavascriptGenerator.prototype.getAdjusted
(not defined on CodeGenerator).
- Change the way forBlock is declared from using an index
signature to using the Record<> template type. The two
should be equivalent but for some reason the former provokes
type errors when used with the 'this' type.
Additionally, deprecate the now-unused (but exported)
BlockGenerator type alias.
Technically the change of signaure is a breaking chnage, but
it is unlikely to affect any developers in practice, since
any block generator function (Block, CodeGenerator) => ...
can be substituted in for (Block, C extends CodeGenerator) =>
..., so any existing generator functions can still be added
to any CodeGenerator or subclass instance's .forBlock. The
only situation in which this would be breaking is if a
developer was obtaining block generator functions
FROM a subclass instance's .forBlock dictionary and assuming
they were (Block CodeGenerator) => ...