Skip to content

Fix generic SFC findComponent types - #2934

Draft
simonyang08 wants to merge 1 commit into
vuejs:mainfrom
simonyang08:codex/fix-generic-sfc-find-component
Draft

Fix generic SFC findComponent types#2934
simonyang08 wants to merge 1 commit into
vuejs:mainfrom
simonyang08:codex/fix-generic-sfc-find-component

Conversation

@simonyang08

Copy link
Copy Markdown

Fixes #2436

Summary

  • recognize generic SFC call signatures in findComponent
  • return VueWrapper instead of falling through to DOMWrapper<Node>
  • add declaration-level regression coverage for <script setup generic> components

Root cause

Generic SFCs emitted by Vue's <script setup generic> syntax expose a generic call signature rather than the construct signature used by DefinedComponent. The existing overloads therefore selected the DOM-wrapper fallback.

Compatibility

The new overload is limited to generic call signatures returning VNode. Existing functional-component and defined-component overloads remain unchanged. The result intentionally uses an unparameterized VueWrapper because findComponent cannot instantiate the SFC's generic type parameter soundly.

Validation

  • actual generic-SFC vue-tsc reproduction - failed before, passed after
  • pnpm tsd - passed
  • pnpm test --run tests/findComponent.spec.ts - 36 passed
  • pnpm build - passed
  • pnpm lint - passed with unrelated existing warnings
  • changed-file formatting and git diff --check - passed

AI disclosure

This change was prepared with OpenAI Codex assistance and reviewed and validated locally by the contributor.

@netlify

netlify Bot commented Aug 27, 2026

Copy link
Copy Markdown

Deploy Preview for vue-test-utils-docs ready!

Name Link
🔨 Latest commit 09567a6
🔍 Latest deploy log https://app.netlify.com/projects/vue-test-utils-docs/deploys/6a9067ec184e2f000868debe
😎 Deploy Preview https://deploy-preview-2934--vue-test-utils-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@simonyang08 simonyang08 changed the title [codex] Fix generic SFC findComponent types Fix generic SFC findComponent types Aug 28, 2026
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.

Bug: TypeScript errors with Vue generic components

2 participants