Files
blockly/core
Christopher Allen 582e19a0f1 fix(generators): Modify type signature of forBlock (#7555)
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) => ...
2023-10-20 15:59:30 +01:00
..
2023-09-13 07:49:13 +02:00
2023-06-21 11:26:22 -07:00
2023-06-16 10:59:36 -07:00
2023-10-10 09:19:44 -07:00