Skip to content

Fix TypeScript build error caused by @wordpress/api-fetch 7.36.0 type changes#3877

Merged
acicovic merged 2 commits intodevelopfrom
copilot/fix-build-errors-in-develop
Nov 28, 2025
Merged

Fix TypeScript build error caused by @wordpress/api-fetch 7.36.0 type changes#3877
acicovic merged 2 commits intodevelopfrom
copilot/fix-build-errors-in-develop

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

Description

Fixes TypeScript inference issue with apiFetch after @wordpress/api-fetch 7.36.0 update introduced stricter type checking for the Parse generic parameter.

The fix explicitly provides the second type parameter to apiFetch:

// Before
const response = await apiFetch<ContentHelperAPIResponse<T>>( options );

// After  
const response = await apiFetch<ContentHelperAPIResponse<T>, true>( options );

This ensures TypeScript infers Parse as the literal type true rather than boolean.

Motivation and context

The Build wp-parsely workflow was failing on develop branch after merging PRs #3857, #3875, and #3876. The error:

TS2345: Argument of type 'APIFetchOptions<boolean>' is not assignable to parameter of type 'APIFetchOptions<true>'.

Ref: https://github.com/Parsely/wp-parsely/actions/runs/19773492039/job/56662041665

How has this been tested?

  • Build passes with Node.js 22.15 (CI environment)
  • All 84 existing tests pass
  • ESLint passes

Screenshots (if appropriate)

N/A - TypeScript type fix only.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/2b1d206d81b74ed999023cffd924f862ff2753c8
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/AxeWP/wp-graphql-stubs/zipball/6ca5c5ee37012743e09e2f9e7c3c272c5e273bb8
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/Masterminds/html5-php/zipball/fcf91eb64359852f00d921887b219479b4f21251
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/r6fj6k /usr/bin/composer install --no-dev --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/b598aa890815b8df16363271b659d73280129101
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/LHMQ3c /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/d71128c702c180ca3b27c761b6773f883394f162
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0ca86845ce43291e8f5692c7356fccf3bcf02bf4
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/845eb62303d2ca9b289ef216356568ccc075ffd1
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/244d7b04fc4bc2117c15f5abe23eb933b5f02bbf
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/7c8d18b4d90dac9e86b0869a608fa09158e168fa
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7795ec6fa05663d716a549d0b44e47ffc8b0d4a6
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/antecedent/patchwork/zipball/8b6b235f405af175259c8f56aea5fc23ab9f03ce
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/composer/installers/zipball/12fb2dfe5e16183de69e784a7b84046c43d97e8e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/LHMQ3c /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/r6fj6k /usr/bin/composer install --no-dev --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/hamcrest/hamcrest-php/zipball/f8b1c0173b22fa6ec77a81fe63e5b01eba7e6487
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6db563514f27e19595a19f45a4bf757b6401194e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/abeb5a8b58fda7ac21f15ee596f302f2959a7114
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/php-stubs/wordpress-tests-stubs/zipball/95979e5c671c72350dde78b89e29afdd88c37140
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan-mockery/zipball/98cac6e256b4ee60fdeb26a7dd81bb271b454e80
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/b564ca479e7e735f750aaac4935af965572a7845
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/phpstan/phpstan/zipball/2770dcdf5078d0b0d53f94317e06affe88419aa8
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/comparator/zipball/67a2df3a62639eab2cc5906065e9805d4fd5dfc5
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/exporter/zipball/14c6ba52f95a36c3d27c835d65efc7123c446e8c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/global-state/zipball/b6781316bdcd28260904e7cc18ec983d0d2ef4f6
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/kh3mlS /usr/bin/composer install --no-interaction --no-progress (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/a15e970b8a0bf64cfa5e86d941f5e6b08855f369
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/3v7J1u /usr/bin/composer install --prefer-dist --no-interaction (http block)
  • iojs.org
    • Triggering command: /usr/bin/curl curl -q --fail --compressed -L -s REDACTED -o - (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

After merging #3857, #3875 and #3876, we're still having build errors in our develop branch. The tricky part is that the build error is not present in the PRs we're opening, but when we merge into develop we get the error that can be found in https://github.com/Parsely/wp-parsely/actions/runs/19773492039/job/56662041665:

ERROR in /home/runner/work/wp-parsely/wp-parsely/src/content-helper/common/base-provider.tsx
151:65-72
[tsl] ERROR in /home/runner/work/wp-parsely/wp-parsely/src/content-helper/common/base-provider.tsx(151,66)
      TS2345: Argument of type 'APIFetchOptions<boolean>' is not assignable to parameter of type 'APIFetchOptions<true>'.
  Type 'boolean' is not assignable to type 'true'.
ts-loader-default_e3b0c44298fc1c14

webpack 5.95.0 compiled with 1 error in 30845 ms
Error: Process completed with exit code 1.

We've tried to solve the error in previous PRs, but it seems we need another method to fix the issue.

Based on all this information, open a PR and propose a plan. We'll need to be checking against the develop branch to see whether our changes are fix things or not.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Summary by CodeRabbit

  • Refactor
    • Optimized internal API type parameterization for improved consistency with the API wrapper layer.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The apiFetch call in the base provider was modified to include a second generic parameter true, changing from apiFetch<ContentHelperAPIResponse<T>>() to apiFetch<ContentHelperAPIResponse<T>, true>(). This adjusts the type parameterization of the API fetch invocation without modifying runtime behavior or error handling.

Changes

Cohort / File(s) Change Summary
API Fetch Type Parameter
src/content-helper/common/providers/base-provider.tsx
Added second generic parameter true to apiFetch call to adjust response type parameterization

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

  • Verify that the second generic parameter true is the correct and intended parameterization for this API fetch context
  • Confirm the change aligns with the apiFetch function's generic signature and type expectations

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: fixing a TypeScript build error caused by @wordpress/api-fetch type changes.
Description check ✅ Passed The description is comprehensive and follows the template structure with all required sections completed: Description, Motivation and context, How has this been tested, and Screenshots.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands and usage tips.

@acicovic
Copy link
Collaborator

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@acicovic
Copy link
Collaborator

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@acicovic acicovic added this to the 3.22.0 milestone Nov 28, 2025
@acicovic acicovic marked this pull request as ready for review November 28, 2025 21:20
@acicovic acicovic requested a review from a team as a code owner November 28, 2025 21:20
Copilot AI changed the title [WIP] Fix build errors in develop branch after merges Fix TypeScript build error caused by @wordpress/api-fetch 7.36.0 type changes Nov 28, 2025
Copilot AI requested a review from acicovic November 28, 2025 21:20
@acicovic acicovic merged commit 3e1e2ad into develop Nov 28, 2025
44 of 55 checks passed
@acicovic acicovic deleted the copilot/fix-build-errors-in-develop branch November 28, 2025 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants