Typescript and Blockly

200 views
Skip to first unread message

Stephen Cameron

unread,
Mar 26, 2021, 10:03:35 PM3/26/21
to Blockly
Hi, great project

Was thinking of using Blockly to use types and definitions from typescript and also generate code with it

Still getting used to Blockly and typescript but would be happy to see what others may suggest

Great project here
Regards

Beka Westberg

unread,
Mar 27, 2021, 10:51:49 AM3/27/21
to blo...@googlegroups.com
Hello,

It is definitely possible to write TypeScript and talk to Blockly. All code in core Blockly is annotated for the Closure compiler, and those annotations are used to generate typings =) But be warned, if you do decide to go this route there will likely always be a few fixes you need to apply. I believe #2937 is kept up with the latest fixes.

If you want to /generate/ TypeScript code with Blockly, that is also possible, but there's no built-in language generator for TypeScript, so you'll have to build your own. There's a great codelab that walks you through creating a JSON language generator, which will help familiarize you with the API. You can also check out the built-in language generators, for example, the JavaScript language generator.

I hope that helps! If you have any further questions please reply =)
--Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/0bd4a7e4-4816-475c-a470-b53dfd5505a2n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages