Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: the returned type of resolveComponent mismatch the argument type of h #2357

Closed
cheqianxiao opened this issue Oct 12, 2020 · 2 comments · Fixed by #2402
Closed

types: the returned type of resolveComponent mismatch the argument type of h #2357

cheqianxiao opened this issue Oct 12, 2020 · 2 comments · Fixed by #2402

Comments

@cheqianxiao
Copy link

cheqianxiao commented Oct 12, 2020

Version

3.0.0

Reproduction link

https://codesandbox.io/s/polished-wind-py4gs?file=/src/index.ts

Steps to reproduce

click the reproduction link.

What is expected?

no type error.

What is actually happening?

type check failed.

@cheqianxiao cheqianxiao changed the title types: the return type of resolveComponent mismatch the argument type of h types: the returned type of resolveComponent mismatch the argument type of h Oct 12, 2020
@edison1105
Copy link
Member

edison1105 commented Oct 12, 2020

const button = resolveComponent("my-button") as ComponentOptions;
as workround.

@cheqianxiao
Copy link
Author

@edison1105 Thanks for replying. your workaround works in the case above. but there is a case in which the paramerter passed to resolveComponent is dynamic:

//value of tagName can  be builtin html tag name such as 'div' or custom global component name 'my-button' for example. 
// in the former situation, type of resolveComponent(tagName) shoud be cast as `string`, while in the latter should be `ComponentOptions`.
const tagName = getTagName();  
resolveComponent(tagName);

@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants