blockly-samples icon indicating copy to clipboard operation
blockly-samples copied to clipboard

Update Angular Sample to latest version 7.20211209.1 - TypeScript definitions problem

Open ignatandrei opened this issue 4 years ago • 3 comments

Category

  • Examples

Component

examples\blockly-angular

Describe the bug

The latest version of blockly 7.20211209.1 has many problems in blockly.d.ts .

Even if the Angular is upgraded to version 13 and TypeScript to 4.5, the errors occurs

To Reproduce

Steps to reproduce the behavior:

  1. Go to examples\blockly-angular and update to latest Angular ( or create a new Angular 13 site )
  2. Run ng serve to see that the angular works
  3. run npm i [email protected] to update to this version
  4. Run ng server
  5. See error

Expected behavior

Latest version should work with Angular without TypeScript problems from block.d.ts

Additional context

Encountered bug when trying to update from blockly 6 to 7 at https://ignatandrei.github.io/BlocklyAutomation/ . ( the reason of this update is another difficult to reproduce bug)

ignatandrei avatar Dec 30 '21 16:12 ignatandrei

Thanks for the issue! Would you mind providing more information on the errors that you are getting? This quarter our types are incomplete as noted in the "Watch out for" section of the release notes. Our current plan is to continue migrating to typescript. Ideally this means that our types should be more complete after next quarter.

alschmiedt avatar Jan 05 '22 17:01 alschmiedt

Hello The error is basically due to the fact that Blockly.getMainWorkspace() is not available when I define new blocks As (one of ) result, the code from

https://github.com/google/blockly/blob/master/core/dropdowndiv.js

DropDownDiv.getContentDiv = function() {
  return DropDownDiv.content_;
};

returns undefined when clicking on dropdown. and gesture never finishes

I can reproduce reliably on my system ( windows) and on build on GitHub actions ( ubuntu)

This is the original bug: https://github.com/ignatandrei/BlocklyAutomation/issues/38

This is affecting just the dropdowns as I see.

If you download the Angular project from http://github.com/ignatandrei/BlocklyAutomation ( run npm install in C:\Users\Surface1\Documents\GitHub\BlocklyAutomation\src\AngWorkspace and in each associated projects ), you will see the error by browsing to http://localhost:4200/automation/loadexample/err38 ( or search in the blocks to err )

ignatandrei avatar Jan 05 '22 19:01 ignatandrei

Nice issue! Documentating/updating the angular-blockly sample would help us Angular dev's very much, but I'm concerned that this approach can somehow "hide" or provide a false-positive that the problems with the types will be fixed.

I would like to add that, the problems with the last release (version 7) that brought to Blcokly several Typescript-based updates aren't limited to the "getMainWorkspace()" function, but it extends to another namespaces, I'm not being able to access "Blockly.Msg" (array of translations) for example, and much other functions and namespaces stopped working properly after that update.

Hope it would be fixed soon, good job on the coolest lib ever made!

joseluiz98 avatar Mar 28 '22 18:03 joseluiz98

This example is now on Angular 15 and Blockly 10 and seems to be working fine - closing this accordingly, but please feel free to reopen if issues remain.

gonfunko avatar Dec 08 '23 17:12 gonfunko