Repository navigation
TypeScript: Migrate packages/list-reusable-blocks package to TypeScript
#70518
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
Merged
manzoorwanijk
merged 14 commits into
WordPress:trunk
from
Infinite-Null:convert/list-reusable-blocks-to-typescript
Apr 13, 2026
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5dde8f8
Migrate `list-reusable-blocks` package to ts
Infinite-Null bf1a575
TypeScript: Define and import types for ImportDropdown and ImportForm…
Infinite-Null 638306b
Merge branch 'trunk' into convert/list-reusable-blocks-to-typescript
Infinite-Null d88ee65
fix: Type in `list-reusable-blocks`
Infinite-Null 2f33a44
fix: Type in list-reusable-blocks
Infinite-Null 0df42b3
chore: Re run test
Infinite-Null 9d45541
chore: Fix README.md
Infinite-Null 3d32343
fix: Update types and add core-data import in list-reusable-blocks
Infinite-Null d29e195
fix: Add @wordpress/core-data as a devDependency in package-lock.json
Infinite-Null e061f7c
fix: Update types for reusableBlock and error in ImportForm component
Infinite-Null a9ec59d
fix: Refactor types and imports in list-reusable-blocks package
Infinite-Null 3f6a89e
fix: Move @wordpress/core-data to dependencies in package-lock.json
Infinite-Null ea3fe78
fix: Add types export and make syncStatus optional in ExportedBlock i…
Infinite-Null f8b19ee
fix: Re-add types field in package.json for list-reusable-blocks
Infinite-Null File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...s/src/components/import-dropdown/index.js → .../src/components/import-dropdown/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 15 additions & 14 deletions
29
...locks/src/components/import-form/index.js → ...ocks/src/components/import-form/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...es/list-reusable-blocks/src/utils/file.js → ...es/list-reusable-blocks/src/utils/file.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import type { Post as CorePost, Type } from '@wordpress/core-data'; | ||
|
|
||
| export interface ImportDropdownProps { | ||
| onUpload: ( data: ReusableBlock ) => void; | ||
| } | ||
|
|
||
| export interface ImportFormProps { | ||
| instanceId: string | number; | ||
| onUpload: ( reusableBlock: ReusableBlock ) => void; | ||
| } | ||
|
|
||
| export type PostType = Type; | ||
|
|
||
| export type Post = CorePost & { wp_pattern_sync_status?: string }; | ||
|
|
||
| export interface ExportedBlock { | ||
| __file: string; | ||
| title: string; | ||
| content: string; | ||
| syncStatus: string; | ||
| } | ||
|
|
||
| export interface ParsedContent { | ||
| __file: string; | ||
| title: string; | ||
| content: string; | ||
| syncStatus?: string; | ||
| [ key: string ]: unknown; | ||
| } | ||
|
|
||
| export interface ReusableBlockMeta { | ||
| wp_pattern_sync_status?: string; | ||
| } | ||
|
|
||
| export interface ReusableBlockData { | ||
| title: string; | ||
| content: string; | ||
| status: string; | ||
| meta?: ReusableBlockMeta; | ||
| } | ||
|
|
||
| export interface ReusableBlock { | ||
| id: number; | ||
| title: { | ||
| raw: string; | ||
| rendered: string; | ||
| }; | ||
| content: { | ||
| raw: string; | ||
| rendered: string; | ||
| }; | ||
| status: string; | ||
| [ key: string ]: unknown; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/tsconfig.json", | ||
| "extends": "../../tsconfig.base.json", | ||
| "references": [ | ||
| { "path": "../api-fetch" }, | ||
| { "path": "../blob" }, | ||
| { "path": "../compose" }, | ||
| { "path": "../components" }, | ||
| { "path": "../core-data" }, | ||
| { "path": "../element" }, | ||
| { "path": "../i18n" } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.