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 TS types for editor package #66754

Merged

Conversation

manzoorwanijk
Copy link
Member

What?

This PR fixes TS types for editor package.

Why?

Currentl, the types for the package are broken because of the third-party types package - @types/wordpress__editor, which we can deprecate following this PR.

How?

The problem with types was that the store object exported by the package was typed as object, which prevented the type generator from setting the types correctly. Thus this PR removes that type annotation to allow inference from imports

Testing Instructions

  • Before this PR, IDE like VS Code would tell you that it is unable to find the type declarations for the package and would suggest to install the above mentioned third-party types package, you can verify that VS Code no longer suggests that.
  • When you install the third-party types package, the types for useSelect and useDispatch are broken and TS yells that the selector is not callable or the method doesn't exist. You can verify that things will work fine without the third-party types

Testing Instructions for Keyboard

Screenshots or screencast

Copy link

github-actions bot commented Nov 5, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: manzoorwanijk <[email protected]>
Co-authored-by: youknowriad <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@tyxla tyxla added [Type] Code Quality Issues or PRs that relate to code quality [Package] Editor /packages/editor labels Nov 6, 2024
@youknowriad
Copy link
Contributor

This change seems fine to me. It looks like we need to run npm install to regenerate the lock again.

@manzoorwanijk
Copy link
Member Author

manzoorwanijk commented Nov 6, 2024

It looks like we need to run npm install to regenerate the lock again.

It was npm run docs:build instead. Thanks

@youknowriad youknowriad enabled auto-merge (squash) November 6, 2024 06:58
@youknowriad youknowriad merged commit 5c6e6f3 into WordPress:trunk Nov 6, 2024
65 of 66 checks passed
@github-actions github-actions bot added this to the Gutenberg 19.7 milestone Nov 6, 2024
@manzoorwanijk manzoorwanijk deleted the fix/ts-types-for-editor-package branch November 6, 2024 10:13
karthick-murugan pushed a commit to karthick-murugan/gutenberg that referenced this pull request Nov 13, 2024
Co-authored-by: manzoorwanijk <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Editor /packages/editor [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants