Skip to content

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

Draft
ryanwelcher wants to merge 4 commits intotrunkfrom
tr/update-register-block-type-types
Draft

Move the @wordpress/blocks types defined in #48604 into own branch.#68213
ryanwelcher wants to merge 4 commits intotrunkfrom
tr/update-register-block-type-types

Conversation

@ryanwelcher
Copy link
Copy Markdown
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

@github-actions
Copy link
Copy Markdown

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 <welcher@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>

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 manzoorwanijk, sirreal and tyxla and removed request for ajitbohra, ellatrix and nerrad December 20, 2024 20:28
@gziolo gziolo mentioned this pull request Dec 23, 2024
40 tasks
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

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

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

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
Copy Markdown
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
Copy Markdown
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.

@github-actions github-actions bot added the [Package] Core data /packages/core-data label Jan 5, 2026
@github-actions github-actions bot added [Package] Editor /packages/editor [Package] Block library /packages/block-library [Package] Block editor /packages/block-editor [Package] Fields /packages/fields labels Jan 5, 2026
@manzoorwanijk
Copy link
Copy Markdown
Member

I am planning to tackle this in a separate PR.

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] Block editor /packages/block-editor [Package] Block library /packages/block-library [Package] Blocks /packages/blocks [Package] Core data /packages/core-data [Package] Editor /packages/editor [Package] Fields /packages/fields [Type] Feature New feature to highlight in changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants