-
Notifications
You must be signed in to change notification settings - Fork 4.5k
TypeScript: Migrate wordcount package to TypeScript #70501
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
TypeScript: Migrate wordcount package to TypeScript #70501
Conversation
- Add comprehensive type definitions in src/types.ts - Convert main index.js to TypeScript with proper typing - Convert defaultSettings.js with type safety
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Adi-ty! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
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. |
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.
This looks good, but losing the git history of a file is something we can try to prevent but I know it's not always feasible.
I have some suggestions for type improvements.
@manzoorwanijk, thanks for the review. I have addressed them. |
Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com>
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.
Thank you for making the changes. This looks good now.
Co-authored-by: Adi-ty <iamadisingh@git.wordpress.org> Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>
export function count( | ||
text: string, | ||
type: Strategy, | ||
userSettings: UserSettings |
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.
This userSettings
should be optional here as it historically has been. Let us create another PR to fix it.
userSettings?: UserSettings
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.
Ok sure
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.
@manzoorwanijk I have opened a new PR fixing this #71106
What?
Part of #67691
Migrating the wordcount package to typescript
Why?
To add type safety
How?
By porting the code to TypeScript