-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
base: trunk
Are you sure you want to change the base?
Conversation
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.
There was a problem hiding this 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?
There was a problem hiding this 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 owntsconfig.json
and outputs.d.ts
files tobuild-types
- Adds
blocks
as a project reference incore-data
,block-library
, andblock-editor
- Populates
packages/blocks/src/types
with all block-related type definitions and updatespackage.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; theBlockType
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 makingshadow
,dimensions
,position
, and__experimentalSelector
optional (?
) 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.
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.
import type { BlockType } from './block-type'; |
Copilot uses AI. Check for mistakes.
import type { BlockType } from './block-type'; | ||
|
There was a problem hiding this comment.
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.
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'; |
There was a problem hiding this comment.
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.
import type { BlockType } from './block-type'; |
Copilot uses AI. Check for mistakes.
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. |
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
andblock-editor
packages.Related: #39915