Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor blockRendering.Types to have type guards #6997

Closed
1 task done
BeksOmega opened this issue Apr 20, 2023 · 2 comments
Closed
1 task done

Refactor blockRendering.Types to have type guards #6997

BeksOmega opened this issue Apr 20, 2023 · 2 comments
Labels
issue: bug Describes why the code or behaviour is wrong type: cleanup

Comments

@BeksOmega
Copy link
Collaborator

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

Currently the Types object has a bunch of methods like isField, isIcon, isInput, etc, which all return numbers, which are then used as predicates.

We should change these to be type guards so that we can elliminate explicit casts within the rendering code. E.g: https://github.com/BeksOmega/blockly/blob/4cd3e0466003dcc15b2cd6355354fed3575031b9/core/renderers/common/drawer.ts#L287

Reproduction steps

N/A

Stack trace

N/A

Screenshots

N/A

Browsers

No response

@BeksOmega BeksOmega added issue: bug Describes why the code or behaviour is wrong issue: triage Issues awaiting triage by a Blockly team member labels Apr 20, 2023
@maribethb maribethb added type: cleanup and removed issue: triage Issues awaiting triage by a Blockly team member labels Apr 26, 2023
@AshwanthramKL
Copy link

Hey @BeksOmega, can I work on this?

@BeksOmega
Copy link
Collaborator Author

@maribethb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Describes why the code or behaviour is wrong type: cleanup
Projects
None yet
Development

No branches or pull requests

4 participants