fix: Make generator types and BlockDefinition less restrictive #6185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The basics
npm run format
andnpm run lint
The details
Resolves
#6079 and problems introduced in #6174
Proposed Changes
Types all of the generators as
any
instead ofBlockly.Generator
. They used to be effectivelyany
before (because they were broken), and typing them asGenerator
is incomplete because there are additional properties on each generator that aren't captured. So giving them a partial type is worse thanany
because there are additional type errors that would have to be silenced.Same for the
BlockDefinition
which is used forBlockly.Blocks
- it was typed asObject
but even that is too strict as e.g. Objects don't have a property calledjsonInit
which we allow objects in Blockly.Blocks to have.For more information, see the discussion in #6174
Behavior Before Change
Behavior After Change
Reason for Changes
Test Coverage
Tested in similar ways to #6174
Documentation
Additional Information