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

Default export of the module has or is using private name 'Props'.ts #1678

Closed
kmq116 opened this issue Apr 22, 2022 · 4 comments
Closed

Default export of the module has or is using private name 'Props'.ts #1678

kmq116 opened this issue Apr 22, 2022 · 4 comments

Comments

@kmq116
Copy link

kmq116 commented Apr 22, 2022

I create a vue3 + typescript + vite project , when I packaging a component by <script setup lang="ts">, I refer to the documents of <script setup>
微信截图_20220422141917

but get this issue
微信截图_20220422142053

then I tried using the following
微信截图_20220422142409
I can see the error disappear
I wonder what the reason is 🤔

@jaredmcateer
Copy link

We only see this issue when bundling our code and emitting declarations (ie., vite build && vue-tsc --emitDeclarationsOnly) so neither the editor nor our lint command (vue-tsc --noEmit) show this as a problem.

The workaround is to either use inline type definition like @kmq116 has shown above or to export it (e.g., export interface Props {...}) but that is not very intuitive, especially when there is no error until the emitting the declarations.

@kmq116
Copy link
Author

kmq116 commented May 28, 2022

Wow, very thanks !!!

@kmq116 kmq116 closed this as completed May 28, 2022
@skirtles-code
Copy link
Contributor

I'm reopening this. I don't fully understand it, but the bottom line is that the code shown in the docs leads to an error.

@NataliaTepluhina
Copy link
Member

Added export as a workaround to the doc about props interface

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

No branches or pull requests

4 participants