Skip to content

Fix e2e-test-utils-playwright's jsdoc and types - #48266

Merged
kevin940726 merged 2 commits into
trunkfrom
fix/playwright-utils-jsdoc
Feb 22, 2023
Merged

kevin940726 merged 2 commits into
trunkfrom
fix/playwright-utils-jsdoc

Conversation

@kevin940726

Copy link
Copy Markdown
Member

What and why?

This PR does two things:

  1. Fix jsdoc in e2e-test-utils-playwright when using from a fixture. Now it correctly shows the jsdoc when hovering over a method.
  2. Remove jsdoc types in favor of typescript types. jsdoc types are never enforced and can be out-of-sync. It's preferred to refer to the TS types if possible.

How?

Use the fancy @borrows jsdoc magic to borrow jsdoc from a pure function to a class field. Due to some circular dependencies issue, we also have to manually type the class field with : typeof methodName to show the jsdoc.

Testing Instructions

npm run build:packages

Hover over some util in the supported editors and see the jsdoc.

Note:
You have to call the function to be able to show the full jsdoc. That is, hovering over editor.getBlocks won't show the jsdoc, but hovering over editor.getBlocks() will show the jsdoc. This is probably a jsdoc or typescript bug.

Screenshots or screencast

jsdoc in VSCode:

image

@github-actions

github-actions Bot commented Feb 21, 2023 •

Copy link
Copy Markdown

Flaky tests detected in 3dada1e345e52fcc4c522db1e77935bb8b2f0e6f.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4229596957
📝 Reported issues:

@kevin940726
kevin940726 force-pushed the fix/playwright-utils-jsdoc branch 3 times, most recently from 3dada1e to 34237b9 Compare February 21, 2023 06:01
@kevin940726
kevin940726 force-pushed the fix/playwright-utils-jsdoc branch from 34237b9 to ff48985 Compare February 22, 2023 03:13

@Mamaduka Mamaduka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you, @kevin940726!

The inline hints look much better now.

CleanShot 2023-02-22 at 09 35 29

@kevin940726
kevin940726 merged commit b80d848 into trunk Feb 22, 2023
@kevin940726
kevin940726 deleted the fix/playwright-utils-jsdoc branch February 22, 2023 06:02
@github-actions github-actions Bot added this to the Gutenberg 15.3 milestone Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Developer Documentation Documentation for developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants