-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core Data: add type for term entity (#69151)
Follow-up to #67668, makes it easy to use term types with `getEntityRecords` and the like
- Loading branch information
1 parent
dc40184
commit fe2195e
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { Context, ContextualField, OmitNevers } from './helpers'; | ||
|
||
import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records'; | ||
|
||
declare module './base-entity-records' { | ||
export namespace BaseEntityRecords { | ||
export interface Term< C extends Context > { | ||
/** | ||
* Unique identifier for the term. | ||
*/ | ||
id: number; | ||
/** | ||
* Number of published posts for the term. | ||
*/ | ||
count: ContextualField< number, 'view' | 'edit', C >; | ||
/** | ||
* HTML description of the term. | ||
*/ | ||
description: ContextualField< string, 'view' | 'edit', C >; | ||
/** | ||
* URL of the term. | ||
*/ | ||
link: string; | ||
/** | ||
* HTML title for the term. | ||
*/ | ||
name: string; | ||
/** | ||
* An alphanumeric identifier for the term unique to its type. | ||
*/ | ||
slug: string; | ||
/** | ||
* Type attribution for the term. | ||
*/ | ||
taxonomy: string; | ||
/** | ||
* The parent term ID. Only present for hierarchical taxonomies. | ||
*/ | ||
parent?: number; | ||
/** | ||
* Meta fields. | ||
*/ | ||
meta: ContextualField< | ||
Record< string, string >, | ||
'view' | 'edit', | ||
C | ||
>; | ||
} | ||
} | ||
} | ||
|
||
export type Term< C extends Context = 'edit' > = OmitNevers< | ||
_BaseEntityRecords.Term< C > | ||
>; |
fe2195e
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.
Flaky tests detected in fe2195e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/13270832348
📝 Reported issues:
/test/e2e/specs/site-editor/template-revert.spec.js