Skip to content

Move the @wordpress/blocks types defined in #48604 into own branch. #68213

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

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

ryanwelcher
Copy link
Contributor

@ryanwelcher ryanwelcher commented Dec 20, 2024

What?

This PR moves only the types from #48604 into a branch in this repo rather than in a fork. This is all of @johnhooks work with the exceptions of some small linting changes required to commit.

This branch can be merged into trunk or used as a feature branch to make small iterations to the package to introduce the types.

Why?

@johnhooks did a lot fantastic work defining the types and while the direction of that PR has changed, it would be a shame to lose that work as we move towards adding Typescript support to the blocks and block-editor packages.

Related: #39915

Copy link

github-actions bot commented Dec 20, 2024

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: ryanwelcher <[email protected]>
Co-authored-by: tyxla <[email protected]>

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

@ryanwelcher ryanwelcher added [Package] Blocks /packages/blocks Developer Experience Ideas about improving block and theme developer experience labels Dec 20, 2024
@ryanwelcher ryanwelcher requested a review from gziolo December 20, 2024 20:24
@ryanwelcher ryanwelcher changed the title Move the types defined in #48604 into own branch Move the @wordpress/blocks types defined in #48604 into own branch. Dec 20, 2024
@ryanwelcher ryanwelcher added the [Type] Feature New feature to highlight in changelogs. label Dec 20, 2024
@ryanwelcher ryanwelcher requested review from sirreal, tyxla and manzoorwanijk and removed request for ajitbohra, nerrad and ellatrix December 20, 2024 20:28
@gziolo gziolo mentioned this pull request Dec 23, 2024
26 tasks
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of the continuity of this great work @ryanwelcher 👏

Since it's quite a large PR, can we make sure all checks are green before opening it for a formal review?

@gziolo gziolo requested a review from Copilot June 17, 2025 07:06
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extracts the @wordpress/blocks TypeScript definitions into a new packages/blocks package and updates consuming packages to reference it.

  • Creates packages/blocks with its own tsconfig.json and outputs .d.ts files to build-types
  • Adds blocks as a project reference in core-data, block-library, and block-editor
  • Populates packages/blocks/src/types with all block-related type definitions and updates package.json to include "types": "build-types"

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/core-data/tsconfig.json Add reference to new blocks package
packages/blocks/tsconfig.json Initialize tsconfig for the new blocks package
packages/blocks/src/types/* Introduce extracted type definitions
packages/blocks/package.json Define types entry for TypeScript declarations
packages/block-library/tsconfig.json Reference blocks tsconfig
packages/block-editor/tsconfig.json Reference blocks tsconfig
Comments suppressed due to low confidence (2)

packages/blocks/src/types/block-variation.ts:7

  • Only BlockExampleInnerBlock is used in this file; the BlockType import can be removed to reduce unused code.
import type { BlockExampleInnerBlock, BlockType } from './block-type';

packages/blocks/src/types/block-supports.ts:348

  • Most support properties in BlockSupports are optional; consider making shadow, dimensions, position, and __experimentalSelector optional (?) for consistency and to avoid requiring them on every block.
shadow: any;

Comment on lines +15 to +16
import type { BlockType } from './block-type';

Copy link
Preview

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

The import of BlockType is not used in this file and can be removed to clean up unused imports.

Suggested change
import type { BlockType } from './block-type';

Copilot uses AI. Check for mistakes.

Comment on lines +4 to +5
import type { BlockType } from './block-type';

Copy link
Preview

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

The import of BlockType is unused here; consider removing it to avoid dead imports.

Suggested change
import type { BlockType } from './block-type';

Copilot uses AI. Check for mistakes.

* Internal dependencies
*/
import type { Block } from './block';
import type { BlockType } from './block-type';
Copy link
Preview

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

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

The BlockType import isn't referenced anywhere in this module; you can safely remove it.

Suggested change
import type { BlockType } from './block-type';

Copilot uses AI. Check for mistakes.

@ryanwelcher
Copy link
Contributor Author

Thanks for running the review @gziolo. I am hoping to pick this back up very soon

@ryanwelcher ryanwelcher marked this pull request as draft June 17, 2025 18:10
@ryanwelcher ryanwelcher marked this pull request as draft June 17, 2025 18:10
@ryanwelcher
Copy link
Contributor Author

Thanks for taking care of the continuity of this great work @ryanwelcher 👏

Since it's quite a large PR, can we make sure all checks are green before opening it for a formal review?

I've moved it to a draft for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Ideas about improving block and theme developer experience [Package] Blocks /packages/blocks [Type] Feature New feature to highlight in changelogs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants