Repository navigation
Conversation
An `any` selector matches every overload, so TS picked the first one. With the generic-SFC overload ahead of the DefinedComponent one, `ReturnType<any>` made `unknown extends ReturnType<T>` true and the result was DOMWrapper<Node>.
✅ Deploy Preview for vue-test-utils-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since 2.5.1,
findComponent()called with a selector typed asanyreturnsDOMWrapper<Node>instead ofVueWrapper<any>, so.vm,.props()and.emitted()on the result no longer type-check. A selector ends up asanywhenever the component's type cannot be inferred, for example a component imported from an untyped JS module, or type-aware linting that resolves.vueimports without Vue language support. Only the types changed; the runtime behavior is the same.The generic-SFC overload added in #2934 was declared before the
DefinedComponentoverload inBaseWrapper.findComponent. Ananyargument is assignable to every overload, so TypeScript resolved it to the first match, and sinceReturnType<any>isany, theunknown extends ReturnType<T>branch evaluated toDOMWrapper<Node>. Moving the generic-SFC overload below theDefinedComponentone restores the 2.5.0 result and matches the orderfindAllComponents(),getComponent()andWrapperLike.findComponent()already use. Generic SFCs keep resolving to the generic overload because their call signature has no construct signature, so they do not matchDefinedComponent;test-dts/genericComponent.d-test.tscovers that.Regression from #2934.
fix #2972