Skip to content

Conversation

@dhruvikpatel18
Copy link
Contributor

What?

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

Why?

Type safety.

Testing Instructions

Type check

@Mamaduka Mamaduka added the [Type] Code Quality Issues or PRs that relate to code quality label Jul 18, 2025
@t-hamano t-hamano added the [Package] Plugins /packages/plugins label Jul 18, 2025
@t-hamano t-hamano mentioned this pull request Jul 18, 2025
40 tasks
@dhruvikpatel18 dhruvikpatel18 marked this pull request as ready for review July 18, 2025 12:45
@github-actions
Copy link

github-actions bot commented Jul 18, 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>

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

Comment on lines 11 to 28
interface PluginErrorBoundaryProps {
/**
* The name of the plugin that may encounter an errors.
*/
name: string;
/**
* The child components to render.
*/
children: ReactNode;
/**
* Callback function called when an error occurs.
*/
onError?: ( name: string, error: Error ) => void;
}

interface PluginErrorBoundaryState {
hasError: boolean;
}
Copy link
Member

Choose a reason for hiding this comment

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

If we,

  • Use React.ReactNode without importing from 'react'
  • Move these two interfaces to a types.ts file in the same directory, and then use
import type {
	PluginErrorBoundaryProps as Props,
	PluginErrorBoundaryState as State,
} from './types';

export class PluginErrorBoundary extends Component< Props, State > {
	//
}

That way, we can preserve the git history of the file.

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 now. Thank you for making the suggested changes.

@manzoorwanijk manzoorwanijk merged commit c81b34f into WordPress:trunk Jul 22, 2025
61 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.3 milestone Jul 22, 2025
USERSATOSHI pushed a commit to USERSATOSHI/gutenberg that referenced this pull request Jul 23, 2025
Co-authored-by: dhruvikpatel18 <dhruvik18@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Plugins /packages/plugins [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