Move the @wordpress/blocks types defined in #48604 into own branch.#68213
Move the @wordpress/blocks types defined in #48604 into own branch.#68213ryanwelcher wants to merge 4 commits intotrunkfrom
@wordpress/blocks types defined in #48604 into own branch.#68213Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@wordpress/blocks types defined in #48604 into own branch.
tyxla
left a comment
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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/blockswith its owntsconfig.jsonand outputs.d.tsfiles tobuild-types - Adds
blocksas a project reference incore-data,block-library, andblock-editor - Populates
packages/blocks/src/typeswith all block-related type definitions and updatespackage.jsonto 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
BlockExampleInnerBlockis used in this file; theBlockTypeimport 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
BlockSupportsare optional; consider makingshadow,dimensions,position, and__experimentalSelectoroptional (?) for consistency and to avoid requiring them on every block.
shadow: any;
| import type { BlockType } from './block-type'; | ||
|
|
There was a problem hiding this comment.
The import of BlockType is not used in this file and can be removed to clean up unused imports.
| import type { BlockType } from './block-type'; |
| import type { BlockType } from './block-type'; | ||
|
|
There was a problem hiding this comment.
The import of BlockType is unused here; consider removing it to avoid dead imports.
| import type { BlockType } from './block-type'; |
| * Internal dependencies | ||
| */ | ||
| import type { Block } from './block'; | ||
| import type { BlockType } from './block-type'; |
There was a problem hiding this comment.
The BlockType import isn't referenced anywhere in this module; you can safely remove it.
| import type { BlockType } from './block-type'; |
|
Thanks for running the review @gziolo. I am hoping to pick this back up very soon |
I've moved it to a draft for now. |
|
I am planning to tackle this in a separate PR. |
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
trunkor 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
blocksandblock-editorpackages.Related: #39915