You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[OPTIONAL:] Refine type of BlockDefinition (in core/blocks.ts) to make defining blocks easier and preferably less error prone.
At the moment BlockDefinition is AnyDuringMigration; this works but means that tsc provides no assistance in verifying block definitions—for example, it does not check to make sure that Block methods are being called (or overridden) correctly.
@btw17 has made some useful suggestions, including in particular defining BlockDefinition as {[Property in keyof Block]?: Block[Property]} & {[key: string]: unknown}, but this is not perfect: e.g. mixin methods do not get the correct type for this.
Create a model PR, migrating one file in blocks/, to verify that the above works as intended.
This is a tracking bug for the remaining work to migrate the Blockly codebase to TypeScript, following the successful migration of
core/.This is part of #5857, and will resolve #6248 and probably also #2995.
Work to be done
scripts/gulpfiles/build_tasks.jsto feed the contents ofblocks/andgenerators/throughtsc.tsconblocks/andgenerators/#6836tests/bootstrap.js, playgrounds, etc. to load blocks and generators frombuild/src/when loading uncompressed.goog.requireso don't care about file location.imports)..js->.tsmigration #6837BlockDefinition(incore/blocks.ts) to make defining blocks easier and preferably less error prone.BlockDefinitionisAnyDuringMigration; this works but means thattscprovides no assistance in verifying block definitions—for example, it does not check to make sure thatBlockmethods are being called (or overridden) correctly.BlockDefinitionas{[Property in keyof Block]?: Block[Property]} & {[key: string]: unknown}, but this is not perfect: e.g. mixin methods do not get the correct type forthis.blocks/, to verify that the above works as intended.blocks/math.jsto TypeScript #6900.blocks/blocks/blocks.jsto TypeScript #7193)blocks/colour.jsto TypeScript #6901)blocks/lists.jsto TypeScript #6902)blocks/logic.jsto TypeScript #7003)blocks/loops.jsto TypeScript #6957)blocks/math.jsto TypeScript #6900)blocks/procedures.jsto TypeScript #7192 )blocks/text.jsto TypeScript #6958)blocks/variables.jsandblocks/variables_dynamic.jsto TypeScript #7001)blocks/variables.jsandblocks/variables_dynamic.jsto TypeScript #7001)generators/Provide more user-friendly generator APIs #7326
Make
CodeGeneratorabstract #7401dart.js
javascript.js
lua.js
php.js
python.js