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

fix!: fix or silence type errors #6105

Merged
merged 13 commits into from
Apr 22, 2022

Conversation

rachel-fenichel
Copy link
Collaborator

@rachel-fenichel rachel-fenichel commented Apr 22, 2022

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Progress on #5857

Proposed Changes

Fix or silence remaining type errors exposed by enabling 'strictCheckTypes' and 'strictMissingProperties' flags for core code.

All changes resolve type errors. Where possible I made the types correct; when I couldn't, I added an item to track additional work in #6097. Most commits fix one error or type of error, so please review one commit at a time.

Things that blocked real fixes:

  • Adding properties to SVG Elements
  • Generic code
  • "Optional" functions that are not part of any interface, and where it's not clear which interface they belong on.

Behavior Before Change

~45 errors in core with those flags enabled.

Behavior After Change

No errors in core with those flags enabled.

Reason for Changes

These type errors were blocking conversion to TypeScript because the MigranTS tool wouldn't run with these errors in place.

Test Coverage

Tested for build errors by enabling 'strictCheckTypes' and 'strictMissingProperties' in build_tasks.js.
Tested runtime errors with unit tests and some basic dragging around in the playground.

Breaking change
Renames isBlockCreatable_ (on FlyoutBase) to isBlockCreatable. It was and still is package.

* otherwise.
* @package
*/
IFlyout.prototype.isBlockCreatable;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is removing the underscore on this name a breaking change?

I still don't understand our policy on external developers overriding @package properties in subclasses. But it seems like if this is part of the interface of a flyout, then renaming part of that interface is a breaking chnage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically a breaking change, so I renamed the PR to fix!.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also added a comment on the breaking change to the PR description.

* @param {boolean} isVisible True if category should be visible.
* @protected
*/
IToolboxItem.prototype.setVisible_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to exist here? Or on the collapsible toolbox item interface?

Copy link
Collaborator Author

@rachel-fenichel rachel-fenichel Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to move all the way up to IToolboxItem because of how it's being used. @alschmiedt said that "we allow any toolbox item to be in a collapsible category" and that it should be left as is for compatibility reasons. But I noted it in my issue for follow-ups, in case we can find a better way to deal with it before the next release.

@@ -743,8 +745,10 @@ class Gesture {
*/
doBubbleClick_() {
// TODO (#1673): Consistent handling of single clicks.
this.startBubble_.setFocus && this.startBubble_.setFocus();
this.startBubble_.select && this.startBubble_.select();
if (this.startBubble_ instanceof WorkspaceCommentSvg) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are workspace comments bubbles? That seems like not what they are.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes for the curious:
I think it's just to make workspace comments similar to block comments. And block comments are icons/bubbles, just like mutators.
Bubbles sit on a different canvas than blocks, and always on top. They do that so that blocks on the workspace can never look like they're inside an open mutator.

@rachel-fenichel rachel-fenichel changed the title fix: fix or silence type errors fix!: fix or silence type errors Apr 22, 2022
@rachel-fenichel rachel-fenichel merged commit daf78af into google:develop Apr 22, 2022
@rachel-fenichel rachel-fenichel deleted the fix_type_annotations branch April 25, 2022 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants