Skip to content

Conversation

adamziel
Copy link
Contributor

@adamziel adamziel commented Jun 8, 2022

What?

All entity record types are parametrized by a generic Context parameter, e.g.:

type MyType = Page<'edit'>

Oftentimes, we need to refer to an entity using its default context type, which gets pretty entangled:

type MyType = Page<DefaultContextOf<Page<any>>>

This PR adds default value to all the Context generic type parameters so that the above can be simplified to:

type MyType = Page

Why?

We want to have autocompletion and TypeScript support for core-data primitives, see #39025 for more context.

Testing Instructions

Confirm the CI checks are green – this PR doesn't contain any runtime changes to test.

@noisysocks @sirreal @dmsnell @sarayourfriend

@adamziel adamziel added [Package] Core data /packages/core-data Developer Experience Ideas about improving block and theme developer experience labels Jun 8, 2022
@adamziel adamziel requested a review from nerrad as a code owner June 8, 2022 10:36
@adamziel adamziel self-assigned this Jun 8, 2022
@adamziel adamziel merged commit f652145 into trunk Jun 8, 2022
@adamziel adamziel deleted the ts/add-default-context-to-core-data-entities branch June 8, 2022 21:22
@github-actions github-actions bot added this to the Gutenberg 13.5 milestone Jun 8, 2022
@mburridge mburridge added the Needs Dev Note Requires a developer note for a major WordPress release cycle label Sep 13, 2022
@mburridge
Copy link
Contributor

Added the Needs Dev Note label in case this needs a dev note (either individual or as part of a "misc" dev note) for WP 6.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Ideas about improving block and theme developer experience Needs Dev Note Requires a developer note for a major WordPress release cycle [Package] Core data /packages/core-data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants