Skip to content

Conversation

@yusuke-omae
Copy link

@yusuke-omae yusuke-omae commented Mar 15, 2023

What?

Fix invalid type Attachment.media_details.

Why?

The current Attachment.media_details is Record<string,string>, but at least in media_details with image media, the sizes field is an object and the types do not match.

How?

Define again the fields commonly used for image media. Also, since media such as audio are not necessarily Record<string,string>, changed to Record<string,any>.

@yusuke-omae yusuke-omae requested a review from nerrad as a code owner March 15, 2023 00:23
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Mar 15, 2023
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @yusuke-omae! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@yusuke-omae yusuke-omae changed the title Fixed type Attachment.media_details @wordpress/core-data: Fixed type Attachment.media_details Mar 15, 2023
@yusuke-omae yusuke-omae changed the title @wordpress/core-data: Fixed type Attachment.media_details @wordpress/core-data: Fix type Attachment.media_details Mar 15, 2023
@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. [Package] Data /packages/data labels Mar 15, 2023
@Mamaduka Mamaduka requested a review from adamziel March 15, 2023 04:06
@gziolo gziolo added [Package] Core data /packages/core-data REST API Interaction Related to REST API and removed [Package] Data /packages/data labels Mar 19, 2023
@Mamaduka
Copy link
Member

Thanks for contributing, @yusuke-omae!

I believe this issue was resolved in recent updates for attachment types. Here's the latest ref - #73223.

cc @andrewserong, @ramonjd

@github-actions
Copy link

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: yusuke-omae <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

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

@andrewserong
Copy link
Contributor

Thanks for the ping and for the contribution here!

I actually think this one might have been fixed in #64496 last year. We did just update the types again to make them more accurate across the different kinds of potential media types, but that earlier PR swapped out Record< string, string > for the MediaDetails interface.

Since this issue has been resolved for a while now, I'll close out this PR, but thanks again for contributing @yusuke-omae! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Core data /packages/core-data REST API Interaction Related to REST API [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants