Skip to content

Migrate shortcode package to TS #70708

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

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

dhruvikpatel18
Copy link
Contributor

What?

Part of: #67691
Migrating the shortcode package to Typescript.

Why?

Type safety.

Testing Instructions

Type check

@dhruvikpatel18 dhruvikpatel18 marked this pull request as ready for review July 14, 2025 09:00
Copy link

github-actions bot commented Jul 14, 2025

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: dhruvikpatel18 <dhruvik18@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>
Co-authored-by: mikeybinns <mikeybinns@git.wordpress.org>

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

@dhruvikpatel18 dhruvikpatel18 marked this pull request as draft July 14, 2025 09:20
@t-hamano t-hamano added [Feature] Shortcodes Related to shortcode functionality [Type] Code Quality Issues or PRs that relate to code quality labels Jul 14, 2025
@t-hamano t-hamano mentioned this pull request Jul 14, 2025
37 tasks
Comment on lines 6 to 12
export * from './types';

// Type definitions that would typically be in types.ts
export type ShortcodeAttrs = {
named: Record< string, string >;
numeric: string[];
};
Copy link
Member

Choose a reason for hiding this comment

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

You can see that we already have types defined in types.ts, we just need to update this file to use those types.

Copy link
Member

Choose a reason for hiding this comment

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

Please check the next steps mentioned in #67416

@dhruvikpatel18 dhruvikpatel18 marked this pull request as ready for review July 25, 2025 09:53
@mikeybinns
Copy link
Contributor

Seems like we've been working on the same thing @dhruvikpatel18

My ticket is #68860. Linking in case you find any changes I made useful :)

I noticed that you used the "var as type" convention in a few places, which actually means the code itself isn't type-safe, because you're overriding the type at the end instead of insuring the code matches the type you've created.

@gziolo was also keen to get the automated testing from my branch into the codebase, so perhaps we can merge our work together?

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 [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants