-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
base: trunk
Are you sure you want to change the base?
Migrate shortcode
package to TS
#70708
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
packages/shortcode/src/index.ts
Outdated
export * from './types'; | ||
|
||
// Type definitions that would typically be in types.ts | ||
export type ShortcodeAttrs = { | ||
named: Record< string, string >; | ||
numeric: string[]; | ||
}; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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? |
What?
Part of: #67691
Migrating the shortcode package to Typescript.
Why?
Type safety.
Testing Instructions
Type check