diff --git a/packages/fields/src/fields/author/author-view.tsx b/packages/fields/src/fields/author/author-view.tsx index 51e0a1ca59b75..8232350af5193 100644 --- a/packages/fields/src/fields/author/author-view.tsx +++ b/packages/fields/src/fields/author/author-view.tsx @@ -17,9 +17,9 @@ import type { User } from '@wordpress/core-data'; /** * Internal dependencies */ -import type { BasePost } from '../../types'; +import type { BasePostWithEmbeddedAuthor } from '../../types'; -function AuthorView( { item }: { item: BasePost } ) { +function AuthorView( { item }: { item: BasePostWithEmbeddedAuthor } ) { const { text, imageUrl } = useSelect( ( select ) => { const { getEntityRecord } = select( coreStore ); diff --git a/packages/fields/src/fields/author/index.tsx b/packages/fields/src/fields/author/index.tsx index 6e5a43d44426d..22f9409e05155 100644 --- a/packages/fields/src/fields/author/index.tsx +++ b/packages/fields/src/fields/author/index.tsx @@ -7,10 +7,10 @@ import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ -import type { BasePost } from '../../types'; +import type { BasePostWithEmbeddedAuthor } from '../../types'; import AuthorView from './author-view'; -const authorField: Field< BasePost > = { +const authorField: Field< BasePostWithEmbeddedAuthor > = { label: __( 'Author' ), id: 'author', type: 'integer', diff --git a/packages/fields/src/types.ts b/packages/fields/src/types.ts index be0391c7c865b..e457ec699554c 100644 --- a/packages/fields/src/types.ts +++ b/packages/fields/src/types.ts @@ -25,10 +25,11 @@ interface Links { interface Author { name: string; + avatar_urls: Record< string, string >; } -interface Embedded { - author?: Author[]; +interface EmbeddedAuthor { + author: Author[]; } export interface BasePost extends CommonPost { @@ -48,7 +49,10 @@ export interface BasePost extends CommonPost { date?: string; modified?: string; author?: number; - _embedded?: Embedded; +} + +export interface BasePostWithEmbeddedAuthor extends BasePost { + _embedded: EmbeddedAuthor; } export interface Template extends CommonPost {