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

Add types for shortcode package #67416

Merged

Conversation

manzoorwanijk
Copy link
Member

@manzoorwanijk manzoorwanijk commented Nov 29, 2024

What?

Add TS types for shortcode package.

Why?

To have better type safety and to unblock blocks package being converted to TS

How?

Unlike #60526, this PR extracts the JSDoc types to a types.ts file to expose types without making changes to the actual JS code.

However, the next steps should be to convert shortcode Object.assign to JS Class declaration for better code quality.

Testing Instructions

  • Verify that CI is happy

Testing Instructions for Keyboard

Screenshots or screencast

Next steps

Deprecate @types/wordpress__shortcode after this PR gets merged and released to npm.

Copy link

github-actions bot commented Nov 29, 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: gziolo <[email protected]>

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

@gziolo gziolo added [Feature] Shortcodes Related to shortcode functionality [Type] Code Quality Issues or PRs that relate to code quality Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code labels Nov 29, 2024
@gziolo
Copy link
Member

gziolo commented Nov 30, 2024

However, the next steps should be to convert shortcode Object.assign to JS Class declaration for better code quality.

Sounds fine, but only makes sense if the file gets converted fully to TypeScript.

@manzoorwanijk
Copy link
Member Author

Sounds fine, but only makes sense if the file gets converted fully to TypeScript.

Yes, that's the plan.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

Nice one. Thank you for working on it.

I had only one question. We also should update the changelog to include the note that types are now available. 🎉

packages/shortcode/src/types.ts Outdated Show resolved Hide resolved
@manzoorwanijk
Copy link
Member Author

Adding changelog now

@manzoorwanijk manzoorwanijk force-pushed the update/add-types-for-shortcode-package branch from be47330 to 4da692e Compare November 30, 2024 07:18
@manzoorwanijk manzoorwanijk requested a review from gziolo November 30, 2024 07:19
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@gziolo gziolo enabled auto-merge (squash) November 30, 2024 07:36
@gziolo gziolo merged commit 9610000 into WordPress:trunk Nov 30, 2024
63 checks passed
@github-actions github-actions bot added this to the Gutenberg 19.9 milestone Nov 30, 2024
@manzoorwanijk manzoorwanijk deleted the update/add-types-for-shortcode-package branch November 30, 2024 07:56
im3dabasia pushed a commit to im3dabasia/gutenberg that referenced this pull request Dec 4, 2024
* Add types for shortcode package

* Remove WP Prefix

* Update CHANGELOG.md

Co-authored-by: manzoorwanijk <[email protected]>
Co-authored-by: gziolo <[email protected]>
michalczaplinski pushed a commit that referenced this pull request Dec 5, 2024
* Add types for shortcode package

* Remove WP Prefix

* Update CHANGELOG.md

Co-authored-by: manzoorwanijk <[email protected]>
Co-authored-by: gziolo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Shortcodes Related to shortcode functionality Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants