Skip to content

yukiya383/blockly-plugin-typed-codegenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What's this?

A plugin which fixes type for code generator modules below:

  • "blockly/javascript"
  • "blockly/python"

Other language might be added, but be sure that only javascript has been verified to work properly.

This plugin is only for typescript project, and has no effect on how it works after compiled.

Usage

  1. Clone this repository to your project.
    • Don't install through npm! This plugin needs to be put outside node_modules to work properly.
    • This is because ambient declarations outside node_modules has the highest priority in type definition solving algorism.
      • I couldn't find formal document, but shown in this verification (this is written in Japanese)
  2. Import from "blockly/*". For example:
import * as JavaScript from "blockly/javascript";
  1. Replace all 'Blockly.JavaScript' to 'JavaScript'.

Usable properties

  • All properties defined in Blockly.Generator
  • ORDER_* constants with numeric literal type
  • [key:string]:(block:Blockly.Block)=>(string|[string,number]) function
    • You can assign code generator function like JavaScript['SampleBlock']=sampleBlockCode;.
    • Using technique shown here

About

A plugin which fixes type for code generator modules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published