Skip to content

Conversation

@Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Sep 16, 2025

What?

Initially discussed in woocommerce/woocommerce@3b133f2#r165804930.

This PR types the Interactivity API's getConfig() function, similar to how it's done for getContext().

Why?

This allows consumers to consume it like this:

const config = getConfig< ConfigType >();

instead of missing the types or having to add a type assertion as

const config = getConfig() as ConfigType;

Testing Instructions

  1. Add this code somewhere in the codebase:
type ConfigType = {
	prop: string;
};

const config = getConfig< ConfigType >();
  1. Verify you don't get a TS error mentioning Expected 0 type arguments, but got 1..

@Aljullu Aljullu self-assigned this Sep 16, 2025
@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: Aljullu <[email protected]>

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

@Aljullu Aljullu added [Type] Code Quality Issues or PRs that relate to code quality [Feature] Interactivity API API to add frontend interactivity to blocks. labels Sep 16, 2025
Aljullu referenced this pull request in woocommerce/woocommerce Sep 16, 2025
@github-actions
Copy link

Flaky tests detected in 072e843.
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/17763767596
📝 Reported issues:

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

Labels

[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants