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

component element can't be typed correctlly #3237

Closed
tjx666 opened this issue May 30, 2023 · 7 comments
Closed

component element can't be typed correctlly #3237

tjx666 opened this issue May 30, 2023 · 7 comments
Labels
question Further information is requested

Comments

@tjx666
Copy link
Contributor

tjx666 commented May 30, 2023

I reproduce this in latest volar starter: https://github.com/tjx666/volar-component-element-issue

image

Version: 1.78.2
Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435
Date: 2023-05-10T15:00:40.428Z
Electron: 22.5.2
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.4.0
Sandboxed: No
Volar: v1.7.8
TakeOver Mode: yes
@sfreytag
Copy link

You can work around the issue with dynamic components for the time being with something like:

<component :is="HelloWorld as any" />

@tjx666
Copy link
Contributor Author

tjx666 commented Jun 26, 2023

@sfreytag vite vue2.7 doesn't support type assertion:

vitejs/vite-plugin-vue2#87

@so1ve
Copy link
Member

so1ve commented Jun 26, 2023

I think this is the intended behavior. You have defined a required prop msg but you didn't pass it to the <compnent> element.

@tjx666
Copy link
Contributor Author

tjx666 commented Jun 26, 2023

@so1ve you are right, but the error message is hard to understand here.

@tjx666 tjx666 closed this as completed Jun 26, 2023
@so1ve so1ve added the question Further information is requested label Jun 26, 2023
@so1ve
Copy link
Member

so1ve commented Jun 26, 2023

这也没办法,转换出来的TSX类型就是这么又臭又长(

@zzzzzshPig
Copy link

这也没办法,转换出来的TSX类型就是这么又臭又长(

考虑用 GPT 优化一下吧 (

@so1ve
Copy link
Member

so1ve commented Jun 30, 2023

You can install a vscode plugin called Pretty Typescript Errors. https://github.com/yoavbls/pretty-ts-errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants