Skip to content

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

Merged

Conversation

Adi-ty
Copy link
Contributor

@Adi-ty Adi-ty commented Jun 24, 2025

What?

Part of #67691
Migrating the wordcount package to typescript

Why?

To add type safety

How?

By porting the code to TypeScript

- Add comprehensive type definitions in src/types.ts
- Convert main index.js to TypeScript with proper typing
- Convert defaultSettings.js with type safety
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jun 24, 2025
Copy link

👋 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.

@Adi-ty Adi-ty changed the title [WIP] TypeScript: Migrate @wordpress/wordcount package to TypeScript [WIP] TypeScript: Migrate wordcount package to TypeScript Jun 24, 2025
@t-hamano t-hamano mentioned this pull request Jun 24, 2025
37 tasks
@Adi-ty Adi-ty changed the title [WIP] TypeScript: Migrate wordcount package to TypeScript TypeScript: Migrate wordcount package to TypeScript Jun 24, 2025
@Adi-ty Adi-ty marked this pull request as ready for review June 24, 2025 13:26
Copy link

github-actions bot commented Jun 24, 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: Adi-ty <iamadisingh@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>

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

@t-hamano t-hamano added the [Type] Code Quality Issues or PRs that relate to code quality label Jun 26, 2025
Copy link
Member

@manzoorwanijk manzoorwanijk left a 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.

@Adi-ty Adi-ty requested a review from manzoorwanijk July 14, 2025 08:12
@Adi-ty
Copy link
Contributor Author

Adi-ty commented Jul 14, 2025

@manzoorwanijk, thanks for the review. I have addressed them.

@Adi-ty Adi-ty requested a review from manzoorwanijk July 14, 2025 08:49
Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com>
@manzoorwanijk manzoorwanijk removed the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jul 14, 2025
@Adi-ty Adi-ty requested a review from manzoorwanijk July 14, 2025 09:07
Copy link
Member

@manzoorwanijk manzoorwanijk left a 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.

@manzoorwanijk manzoorwanijk merged commit c085752 into WordPress:trunk Jul 18, 2025
59 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.3 milestone Jul 18, 2025
USERSATOSHI pushed a commit to USERSATOSHI/gutenberg that referenced this pull request Jul 23, 2025
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
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok sure

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[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