Skip to content

Fixed a TS overload error in admin-x-framework tinybird tests#29079

Merged
9larsons merged 1 commit into
mainfrom
slars/sweet-zhukovsky-dd169b
Jul 3, 2026
Merged

Fixed a TS overload error in admin-x-framework tinybird tests#29079
9larsons merged 1 commit into
mainfrom
slars/sweet-zhukovsky-dd169b

Conversation

@9larsons

@9larsons 9larsons commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • admin-x-framework's test:types was failing on use-tinybird-query.test.ts and use-tinybird-token.test.tsx: the test wrapper passed children positionally to React.createElement(AppProvider, {...}, children), but AppProviderProps.children is a required (non-optional) prop. TS's createElement<P> overload resolution can't reconcile a positional child with a required children field in P, so it falls through to a stricter overload and errors.
  • Fixed by moving children into the props object at all three call sites.
  • This has been broken for a while but invisible in CI: test:unit is scoped to Nx---affected projects, and nothing in admin-x-framework's dependency graph was touched by the @types/react catalog bump that started tripping this overload, so the project's test:types/test:unit target never re-ran to surface it.

Test plan

  • pnpm --filter @tryghost/shade --filter @tryghost/admin-x-design-system build (rebuild workspace deps)
  • cd apps/admin-x-framework && pnpm testtsc --noEmit clean, 30 test files / 436 tests passing
  • pnpm lint in apps/admin-x-framework clean

The AppProvider test wrapper passed `children` positionally to
React.createElement, but AppProviderProps.children is required, not
optional. TypeScript's createElement overload resolution can't
reconcile a required children field supplied positionally, so tsc
fails these test files. Moved children into the props object instead.

This slipped through because CI scopes unit tests to Nx-affected
projects, and nothing in admin-x-framework's dependency graph was
touched by the @types/react catalog bump that started tripping this
overload, so the project's test:unit target never re-ran to catch it.
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 081ff0a3-9054-4451-853e-110530e2e06c

📥 Commits

Reviewing files that changed from the base of the PR and between 59440f6 and 311c38a.

📒 Files selected for processing (2)
  • apps/admin-x-framework/test/unit/hooks/use-tinybird-query.test.ts
  • apps/admin-x-framework/test/unit/hooks/use-tinybird-token.test.tsx

Walkthrough

Changes

This change updates test wrapper code in two unit test files (use-tinybird-query.test.ts and use-tinybird-token.test.tsx) that create AppProvider elements via React.createElement. The children value is now included inside the props object passed to AppProvider (e.g., {appSettings: ..., children}) instead of being supplied as the separate third argument to React.createElement. This affects the web analytics gate wrapper, the withAppSettings wrapper, and the loadingWrapper.

Sequence Diagram(s)

Not applicable — this change is limited to test wrapper prop wiring and does not alter runtime call sequences.

Possibly related PRs

  • TryGhost/Ghost#28713: Adds the "web analytics gate" behavior checks for useTinybirdQuery/useTinybirdToken that these test wrapper updates directly support.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing a TypeScript overload error in tinybird tests.
Description check ✅ Passed The description accurately describes the affected tests, the TS overload issue, and the applied fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch slars/sweet-zhukovsky-dd169b

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@nx-cloud

nx-cloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 311c38a

Command Status Duration Result
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 11m 41s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded <1s View ↗
nx run @tryghost/admin:build ✅ Succeeded 4m 11s View ↗
nx run-many -t test:unit -p @tryghost/admin-x-f... ✅ Succeeded 3m 56s View ↗
nx run ghost-admin:test ✅ Succeeded 2m 49s View ↗
nx run-many -t lint -p @tryghost/admin-x-framew... ✅ Succeeded 1m 31s View ↗
nx run @tryghost/activitypub:test:acceptance ✅ Succeeded 52s View ↗
nx run ghost:build:assets ✅ Succeeded 2s View ↗
nx run ghost:build:tsc ✅ Succeeded 6s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-03 17:22:29 UTC

@9larsons 9larsons enabled auto-merge (squash) July 3, 2026 17:22
@9larsons 9larsons merged commit 1c96f5f into main Jul 3, 2026
43 checks passed
@9larsons 9larsons deleted the slars/sweet-zhukovsky-dd169b branch July 3, 2026 17:24
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.

1 participant