Typescript definition file generator for Google's Blockly.
This project generates the Typescript definition file (d.ts file) for Google's Blockly required to get type safety via the Typescript compiler. Currenlty, this only generates the type defintions for Blockly's core folder.
Blockly now ships it's own typescript d.ts
file. They generate the file the same way I do, except I also exposed private fields. Prefer their bundled version and only use these types if you are using a version before types were bundled or need all the private types defined.
Since these definitions aren't consumable via npm
, the last generated d.ts file is checked in for reference. You should generate your own if you're using a different version of Blockly.
- If you need to generate a new version of the definition file, see instructions.
- Generated definition file location: dist/blockly-core.d.ts
- Let
tsc
know about the new typing file.- See Typescript Handbook if you need more guidance in including Typescript definition files.
- Add matching version of Blockly to your project.
- This project only provides the definition file; you still need to include the Blockly library.
- Blockly uses the closure-library and some of the reference types found there (e.g.,
goog.math
). Fortsc
to be happy, you'll have to define these referenced closure-library types. I currently don't do this for you.
git clone https://github.com/trodi/blockly-d.ts.git
npm install
npm start
and follow prompts- Generated files found in dist/