Skip to content

Refactor @wordpress/components package to TypeScript #35744

@andrewserong

Description

@andrewserong

Related to #30503, #28399 and #27484

Context ✨

We would like to refactor the entire @wordpress/components package to TypeScript.

Some components are already written in TypeScript, while the majority of the code is still written in JavaScript.

By refactoring the whole package to TypeScript, we would be able to take advantage of type safety, while also providing first-party types to the package's consumers (instead of the third-party ones).

A fully-typed set of components would also potentially allow us to generate documentation programmatically based off types.

Details of the refactor 🔍

The refactors should introduce the least amount of runtime changes possible — ideally none. All JS files should be refactored to TypeScript.

You can also refer to the TypeScript migration guide in the @wordpress/components package guidelines., and reference an existing component like ItemGroup or ToolsPanel.

Next up

Once the refactor to TypeScript is complete, we'll be able to:

  • migrate all components to Emotion for styles
  • refactor folder structures, potentially split into hook+component
  • refactor components to use context
  • remove (or mark as deprecated) the third party types

List ⚒️

The components in the exclude list of our tsconfig are particularly high priority.

Click to reveal the dependency graph

dependencygraph

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Package] Components/packages/components[Type] Code QualityIssues or PRs that relate to code quality[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.

    Type

    No type

    Projects

    Status

    Done 🎉

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions