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 e2e-test-utils-playwright's jsdoc and types #48266

Merged
merged 2 commits into from
Feb 22, 2023

Conversation

kevin940726
Copy link
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
Copy link

github-actions bot commented Feb 21, 2023

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
Copy link
Member

@Mamaduka Mamaduka left a comment

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