-
-
Notifications
You must be signed in to change notification settings - Fork 392
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
Incorrect handling of importing types in script-setup #300
Comments
This is a problem with the Vue compiler, the main issue about it is here: Your code is correct, but the compiler exposes all imports (without knowing if they're a type or not, as there's not cross-file analysis going on here) to the template. A consequence is that it's impossible to use const enums in script setup, see #277 as well. |
Well now I see what is going on with that, but I am curious why then am I not getting a runtime error |
Prob. because your code doesn't use that value symbol. I also believe that in production build, |
This is designed behavior to prevent runtime error. See #209 (comment). |
App.vue:
I see that explicitly defining the
Ref<number>
type is not necessary, but this is just an example. VSCode shows an error in theimport
statement:Which is not actually an error because the imported type
Ref
is not being used as a value anywhere. This doesn't happen if we rewrite this code without using<script setup>
:The text was updated successfully, but these errors were encountered: